public FilePath PathFrom(FilePath from) { if (!from.isDirectory) { return PathFrom(from.Parent); } if (isAbsolute) { return new FilePath(WorkOutRelativePath(from.Path, this.Path, 0), this.IsDirectory, false); } return this; }
public FilePath ToAbsolutePath(FilePath from) { if (isAbsolute) { return this; } if (!from.isDirectory) { return ToAbsolutePath(from.Parent); } return new FilePath(System.IO.Path.Combine(from.Path, this.Path), this.IsDirectory, true); }
private static FilePath FindScript(FilePath path, string file) { var searchPath = path.File(file); if (File.Exists(searchPath.Path)) { return searchPath; } searchPath = path.Directory("Scripts").File(file); if (File.Exists(searchPath.Path)) { return searchPath; } var parent = path.Parent; if (parent == null) { return null; } return FindScript(parent, file); }
public XmlFile(FilePath filePath) { this.filePath = filePath; }
public static ExternalSolutionApi GetSolutionFile(string path) { var parser = new SolutionFileParser(); var filePath = new FilePath(path, false); return new ExternalSolutionApi(parser.Parse(filePath, filePath.FileContent().AsLines())); }