Example #1
0
    /// <summary>
    ///   Makes sure the save directory exists
    /// </summary>
    public static void MakeSureDirectoryExists(string path)
    {
        using var directory = new Directory();
        var result = directory.MakeDirRecursive(path);

        if (result != Error.AlreadyExists && result != Error.Ok)
        {
            throw new IOException($"can't create folder: {path}");
        }
    }
Example #2
0
 public void Create(bool recursive = true)
 {
     using (var directory = new Directory())
     {
         if (recursive)
         {
             directory.MakeDir(Path).ThrowOnError();
         }
         else
         {
             directory.MakeDirRecursive(Path).ThrowOnError();
         }
     }
 }