Exemplo n.º 1
0
 public static string[] GetDirectories(string path)
 {
     if (path.Length < MAX_PATH)
     {
         return(System.IO.Directory.GetDirectories(path));
     }
     else
     {
         return(LongPathDirectory.EnumerateDirectories(path).ToArray());
     }
 }
Exemplo n.º 2
0
        static IEnumerable <Directory> DirectoriesRecurse(FileSystem fs, Directory directory, string filter)
        {
            // TODO: needs to be replaced with a cross-platform enumeration
            foreach (var topDir in LongPathDirectory.EnumerateDirectories(directory.Path, filter))
            {
                foreach (var subDir in DirectoriesRecurse(fs, fs.GetDirectory(topDir), filter))
                {
                    yield return(subDir);
                }

                yield return(fs.CreateDirectory(topDir));
            }
        }
Exemplo n.º 3
0
        private void DeleteAllFolder(String parentDirectory)
        {
            if (parentDirectory == null)
            {
                return;
            }

            foreach (String file in LongPathDirectory.EnumerateFiles(parentDirectory))
            {
                LongPathFile.Delete(file);
            }

            foreach (String info in LongPathDirectory.EnumerateDirectories(parentDirectory))
            {
                this.DeleteAllFolder(info);
            }

            Microsoft.Experimental.IO.LongPathDirectory.Delete(parentDirectory);
        }
            public override IEnumerable <string> EnumerateDirectories(string path, string searchPattern = "*", bool recursive = false)
            {
                IEnumerable <string> directories = LongPathDirectory.EnumerateDirectories(path, searchPattern);

                foreach (string directory in directories)
                {
                    yield return(directory);
                }

                if (recursive)
                {
                    foreach (string directory in directories)
                    {
                        foreach (string subdirectory in EnumerateDirectories(directory, searchPattern, recursive: true))
                        {
                            yield return(subdirectory);
                        }
                    }
                }
            }
Exemplo n.º 5
0
 public virtual IEnumerable <Directory> Directories()
 {
     return(LongPathDirectory.EnumerateDirectories(Path).Select(CreateDirectory).Cast <Directory>());
 }
Exemplo n.º 6
0
 IEnumerable <Directory> DirectoriesTopOnly(string filter)
 {
     return(LongPathDirectory.EnumerateDirectories(Path, filter).Select(CreateDirectory));
 }