/// <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)));
        }
Exemple #2
0
 public bool Exists(IAbsolutePath path)
 {
     return(path.MatchWith(
                (AbsoluteFilePath file) => File.Exists(file.NativePath),
                (AbsoluteDirectoryPath directory) => Directory.Exists(directory.NativePath)));
 }
Exemple #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)));
 }
Exemple #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))));
 }
 public static bool IsProjectFile(this IAbsolutePath path)
 {
     return(path.MatchWith(
                (AbsoluteFilePath file) => file.IsProjectFile(),
                (AbsoluteDirectoryPath dir) => false));
 }