/// <summary> /// /// </summary> /// <param name="path"> /// arbitrary path - absolute, relative to anything, ... /// </param> public RelativePath(string path) { _path = path; if (Path.IsPathRooted(_path)) { _absolutePath = _path; } else { string cwd = Directory.GetCurrentDirectory(); if (PathsIntersects(cwd, _path)) { _absolutePath = IntersectedPathsJoin(cwd, _path); } else { _absolutePath = cwd + Path.DirectorySeparatorChar + _path; } } _fileName = GetLastPartOfPath(_path); string gitRootAbsolute = Traverser.GetRootDirPath(); _relativeToGitRootPath = _absolutePath.Substring(gitRootAbsolute.Length + 1); }
private static bool IsRepositoryInitialized() { return(Traverser.GetRootDirPath() != null); }