Confuser.Core/Utils.cs
/// <summary>
///     Obtains the relative path from the specified base path.
/// </summary>
/// <param name="filespec">The file path.</param>
/// <param name="folder">The base path.</param>
/// <returns>The path of <paramref name="filespec" /> relative to <paramref name="folder" />.</returns>
Obtains the relative path from the specified base path.
Obtains the relative path from the specified base path .
public static string GetRelativePath(string filespec, string folder)
        {
            var pathUri = new Uri(filespec);
            if (!folder.EndsWith(Path.DirectorySeparatorChar.ToString()))
            {
                folder += Path.DirectorySeparatorChar;
            }
            var folderUri = new Uri(folder);
            return Uri.UnescapeDataString(folderUri.MakeRelativeUri(pathUri).ToString().Replace('/', Path.DirectorySeparatorChar));
        }
public static string GetRelativePath ( string filespec , string folder ) { var pathUri = new Uri ( filespec ) ; if ( ! folder . EndsWith ( Path . DirectorySeparatorChar . ToString ( ) ) ) { folder += Path . DirectorySeparatorChar ; } var folderUri = new Uri ( folder ) ; return Uri . UnescapeDataString ( folderUri . MakeRelativeUri ( pathUri ) . ToString ( ) . Replace ( ' ' , Path . DirectorySeparatorChar ) ) ; }
Obtains the relative path from the specified base path.
Obtains the relative path from the specified base path .
//http://stackoverflow.com/a/703292/462805 // Folders must end in a slash
The path of  relative to .
The path of relative to .
filespec
string
The file path.
The file path .
folder
string
The base path.
The base path .