Esempio n. 1
0
        public DokanError DeleteDirectory(string fileName, DokanFileInfo info)
        {
            Directory currentDir = new Directory(fileName);
            if (!currentDir.Exists())
            {
                return DokanError.ErrorPathNotFound;
            }

            // Windows Explorer 将会处理递归删除部分,所以这里不需要处理
            if (currentDir.Count() > 0)
            {
                return DokanError.ErrorDirNotEmpty;
            }

            Directory dir = new Directory(Util.GetPathDirectory(fileName));
            if (!dir.Exists())
            {
                return DokanError.ErrorPathNotFound;
            }

            String name = Util.GetPathFileName(fileName);

            if (!dir.Contains(name))
            {
                return DokanError.ErrorFileNotFound;
            }

            dir.Delete(name);
            return DokanError.ErrorSuccess;
        }