Method filesystem.more.comparePaths(+ 1 overload)
Overload
Compares final paths of two existing files or directories to determine equality or relationship.
public static CPResult comparePaths(string pathA, string pathB, bool ofSymlinkA = false, bool ofSymlinkB = false)
Parameters
pathA (string)
Full or relative path of an existing file or directory, in any format. Supports environment variables (see pathname.expand). |
pathB (string)
Full or relative path of an existing file or directory, in any format. Supports environment variables (see pathname.expand). |
ofSymlinkA (bool)
If pathA is of a symbolic link, get final path of the link, not of its target. |
ofSymlinkB (bool)
If pathB is of a symbolic link, get final path of the link, not of its target. |
Returns
Exceptions
ArgumentException
Not full path. |
Remarks
Before comparing, calls filesystem.more.getFinalPath, therefore paths can have any format.
Example: @"C:\Test\"
and @"C:\A\..\Test"
are equal.
Example: @"C:\Test\file.txt"
and "file.txt"
are equal if the file is in @"C:\Test
and @"C:\Test
is current directory.
Example: @"C:\Temp\file.txt"
and "%TEMP%\file.txt"
are equal if TEMP
is an environment variable = @"C:\Temp
.
See Also
Overload(top)
Compares final paths of two existing files or directories to determine equality or relationship. Also gets final paths (see filesystem.more.getFinalPath).
public static CPResult comparePaths(ref string pathA, ref string pathB, bool ofSymlinkA = false, bool ofSymlinkB = false)
Parameters
pathA (string)
Full or relative path of an existing file or directory, in any format. Supports environment variables (see pathname.expand). |
pathB (string)
Full or relative path of an existing file or directory, in any format. Supports environment variables (see pathname.expand). |
ofSymlinkA (bool)
If pathA is of a symbolic link, get final path of the link, not of its target. |
ofSymlinkB (bool)
If pathB is of a symbolic link, get final path of the link, not of its target. |
Returns
Exceptions
ArgumentException
Not full path. |
Remarks
Before comparing, calls filesystem.more.getFinalPath, therefore paths can have any format.
Example: @"C:\Test\"
and @"C:\A\..\Test"
are equal.
Example: @"C:\Test\file.txt"
and "file.txt"
are equal if the file is in @"C:\Test
and @"C:\Test
is current directory.
Example: @"C:\Temp\file.txt"
and "%TEMP%\file.txt"
are equal if TEMP
is an environment variable = @"C:\Temp
.