Example #1
0
 private void CheckFileExists(MountFilePath file)
 {
     if (!file.Mount.Exists(file.Path) || file.Mount.IsDir(file.Path))
     {
         throw new FileNotFoundException(string.Format("No such file: {0}", file.GetGlobalPath()));
     }
 }
Example #2
0
 private void CheckDirDoesNotExist(MountFilePath file)
 {
     if (file.Mount.Exists(file.Path) && file.Mount.IsDir(file.Path))
     {
         throw new IOException(string.Format("Directory {0} already exists", file.GetGlobalPath()));
     }
 }
Example #3
0
 private void CheckEitherDoesNotExist(MountFilePath file)
 {
     if (file.Mount.Exists(file.Path))
     {
         throw new IOException(string.Format("Path {0} already exists", file.GetGlobalPath()));
     }
 }
Example #4
0
 private void CheckPathsNotOverlapping(MountFilePath src, MountFilePath dst)
 {
     if (src.Mount == dst.Mount)
     {
         if (src.Path.IsParentOf(dst.Path) || dst.Path.IsParentOf(src.Path))
         {
             throw new IOException(string.Format("Cannot move or copy path {0} inside itself", src.GetGlobalPath()));
         }
     }
 }