Esempio n. 1
0
        /// <exception cref="IOException" />
        /// <exception cref="UnauthorizedAccessException" />
        IEnumerable <AbsoluteFilePath> GetProjects(IAbsolutePath directoryOrFileInProject)
        {
            if (!_fileSystem.Exists(directoryOrFileInProject))
            {
                throw new FileNotFoundException(
                          "Could not find file or directory `" + directoryOrFileInProject.NativePath + "`",
                          directoryOrFileInProject.NativePath);
            }

            return(directoryOrFileInProject.MatchWith(
                       (AbsoluteFilePath file) => GetProjectsContaining(file),
                       (AbsoluteDirectoryPath dir) => GetProjectsInOrContaining(dir)));
        }
Esempio n. 2
0
 public bool Exists(IAbsolutePath path)
 {
     return(path.MatchWith(
                (AbsoluteFilePath file) => File.Exists(file.NativePath),
                (AbsoluteDirectoryPath directory) => Directory.Exists(directory.NativePath)));
 }
Esempio n. 3
0
 public static IRelativePath RelativeTo(this IAbsolutePath destination, AbsoluteDirectoryPath source)
 {
     return(destination.MatchWith(
                (AbsoluteFilePath file) => (IRelativePath)file.RelativeTo(source),
                (AbsoluteDirectoryPath dir) => (IRelativePath)dir.RelativeTo(source)));
 }
Esempio n. 4
0
 public static IAbsolutePath Rename(this IAbsolutePath path, string newName)
 {
     return(path.MatchWith(
                (AbsoluteFilePath file) => (IAbsolutePath)file.Rename(new FileName(newName)),
                (AbsoluteDirectoryPath dir) => (IAbsolutePath)dir.Rename(new DirectoryName(newName))));
 }
Esempio n. 5
0
 public static bool IsProjectFile(this IAbsolutePath path)
 {
     return(path.MatchWith(
                (AbsoluteFilePath file) => file.IsProjectFile(),
                (AbsoluteDirectoryPath dir) => false));
 }