/// <summary>
 /// Enumerates all directories that are located within the specified path.
 /// </summary>
 /// <param name="path"></param>
 /// <param name="recursive">If true, the specified path will be searched recursively and yield all descendant directory paths.</param>
 /// <returns></returns>
 public static IEnumerable <string> GetDirectories(string path, bool recursive = false)
 {
     if (string.IsNullOrWhiteSpace(path))
     {
         return(Enumerable.Empty <string>());
     }
     PathOp.CheckInvalidPathChars(path);
     return(CoheeApp.SystemBackend.FileSystem.GetDirectories(path, recursive));
 }
 /// <summary>
 /// Deletes the directory that is referred to by the specified path.
 /// </summary>
 /// <param name="path"></param>
 public static void Delete(string path)
 {
     if (string.IsNullOrWhiteSpace(path))
     {
         return;
     }
     PathOp.CheckInvalidPathChars(path);
     CoheeApp.SystemBackend.FileSystem.DeleteDirectory(path);
 }
 /// <summary>
 /// Returns whether the specified path refers to an existing directory.
 /// </summary>
 /// <param name="path"></param>
 /// <returns></returns>
 public static bool Exists(string path)
 {
     if (string.IsNullOrWhiteSpace(path))
     {
         return(false);
     }
     PathOp.CheckInvalidPathChars(path);
     return(CoheeApp.SystemBackend.FileSystem.DirectoryExists(path));
 }
 /// <summary>
 /// Creates a directory tree matching the specified directory path.
 /// </summary>
 /// <param name="path"></param>
 public static void Create(string path)
 {
     if (string.IsNullOrWhiteSpace(path))
     {
         throw new ArgumentException("The specified path is null or whitespace-only.");
     }
     PathOp.CheckInvalidPathChars(path);
     CoheeApp.SystemBackend.FileSystem.CreateDirectory(path);
 }
Пример #5
0
 /// <summary>
 /// Opens an existing file at the specified path and returns a <see cref="System.IO.Stream"/> to it.
 /// </summary>
 /// <param name="path"></param>
 /// <param name="mode"></param>
 public static Stream Open(string path, FileAccessMode mode)
 {
     if (string.IsNullOrWhiteSpace(path))
     {
         throw new ArgumentException("The specified path is null or whitespace-only.");
     }
     PathOp.CheckInvalidPathChars(path);
     return(CoheeApp.SystemBackend.FileSystem.OpenFile(path, mode));
 }