src/T4Toolbox/FileMethods.cs
/// <summary>
/// Converts absolute path to a relative path.
/// </summary>
/// <param name="fromFile">
/// Full path to the base file.
/// </param>
/// <param name="toFile">
/// Full path to the target file.
/// </param>
/// <returns>
/// Relative path to the specified file.
/// </returns>
Converts absolute path to a relative path.
Converts absolute path to a relative path .
internal static string GetRelativePath(string fromFile, string toFile)
        {
            var relativePath = new StringBuilder(260);
            if (!NativeMethods.PathRelativePathTo(relativePath, fromFile, 0, toFile, 0))
            {
                throw new ArgumentException(
                    string.Format(
                        CultureInfo.CurrentCulture,
                        "Cannot convert '{0}' to a path relative to the location of '{1}'.",
                        toFile,
                        fromFile));
            }
            return relativePath.ToString();
        }
internal static string GetRelativePath ( string fromFile , string toFile ) { var relativePath = new StringBuilder ( 260 ) ; if ( ! NativeMethods . PathRelativePathTo ( relativePath , fromFile , 0 , toFile , 0 ) ) { throw new ArgumentException ( string . Format ( CultureInfo . CurrentCulture , " " , toFile , fromFile ) ) ; } return relativePath . ToString ( ) ; }
Converts absolute path to a relative path.
Converts absolute path to a relative path .
Relative path to the specified file.
Relative path to the specified file .
fromFile
string
Full path to the base file.
Full path to the base file .
toFile
string
Full path to the target file.
Full path to the target file .