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())); } }
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())); } }
private void CheckEitherDoesNotExist(MountFilePath file) { if (file.Mount.Exists(file.Path)) { throw new IOException(string.Format("Path {0} already exists", file.GetGlobalPath())); } }
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())); } } }