Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static string MakeRelativePath(string absolutePath, string pivotFolder)
- {
- //string folder = Path.IsPathRooted(pivotFolder)
- // ? pivotFolder : Path.GetFullPath(pivotFolder);
- string folder = pivotFolder;
- Uri pathUri = new Uri(absolutePath);
- // Folders must end in a slash
- if (!folder.EndsWith(Path.DirectorySeparatorChar.ToString()))
- {
- folder += Path.DirectorySeparatorChar;
- }
- Uri folderUri = new Uri(folder);
- Uri relativeUri = folderUri.MakeRelativeUri(pathUri);
- return Uri.UnescapeDataString(
- relativeUri.ToString().Replace('/', Path.DirectorySeparatorChar));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement