public void ResolveTest() { Assert.AreEqual("/var/file", PathLib.Resolve("/var/lib", "../", "file/")); Assert.AreEqual("/var/file", PathLib.Resolve("/var/lib", "../", "", "file/")); Assert.AreEqual("/file", PathLib.Resolve("/var/lib", "/../", "file/")); Assert.AreEqual("/", PathLib.Resolve("a/b/c/", "../../..")); Assert.AreEqual("/", PathLib.Resolve(".")); Assert.AreEqual("/absolute", PathLib.Resolve("/some/dir", ".", "/absolute/")); Assert.AreEqual("/foo/tmp.3/cycles/root.js", PathLib.Resolve("/foo/tmp.3/", "../tmp.3/cycles/root.js")); Assert.AreEqual("/foo", PathLib.Resolve("../foo")); }
private string GetPath(string realpath) { return(PathLib.Resolve(Path.GetRelativePath(realpath, _rootPath))); }
private async Task HandleScanner(FileSystemDirectoryWalker.WalkerItem item) { await IndexDirectory(PathLib.Resolve("/", item.Path), item.FileHandle, item.Entries); }
private string GetRealPath(string path) { return(Path.Join(_rootPath, PathLib.Resolve(path))); }