/// <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))); }
public bool Exists(IAbsolutePath path) { return(path.MatchWith( (AbsoluteFilePath file) => File.Exists(file.NativePath), (AbsoluteDirectoryPath directory) => Directory.Exists(directory.NativePath))); }
public static IRelativePath RelativeTo(this IAbsolutePath destination, AbsoluteDirectoryPath source) { return(destination.MatchWith( (AbsoluteFilePath file) => (IRelativePath)file.RelativeTo(source), (AbsoluteDirectoryPath dir) => (IRelativePath)dir.RelativeTo(source))); }
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)); }