RPath

Author: toralf, Titan Last Modified: 20070525


Calculates a path by comparing two pathes, FROM and TO.

RPath_Absolute(AbsolutPath, RelativePath, s="\")
RPath_Relative(MasterPath, SlavePath, s="\")

For the functions's parameters and return value, please see it's source code or the document.

Remarks

Look at second page of forum thread for some variations.

I have changed the function names and added a common prefix too:
1. from RelativePath() to RPath_Relative() and
2. from AbsolutePath() to RPath_Absolute()

For update's details and remarks related to the functions, please see the AutoHotkey Forum: http://www.autohotkey.com/forum/topic19489.html

License

nonexistent

Example

; #Include RPath.ahk
#NoEnv
SendMode Input
SetWorkingDir %A_ScriptDir%

; From Path2 to Path1

Path1 = ahkstdlib\samp\foo\bar
Path2 = ahkstdlib\samp
p = Path1=%Path1%`nPath2=%Path2%`n`n
MsgBox, % p . "> RPath_Relative(Path1, Path2)`n`n" . RPath_Relative(Path1, Path2)

Path1 = \\server.com\user\Files\Docs\Code\AHK\SciTEDirector\includes
Path2 = ..\..\SmartGui\no_commit\icons_dev
p = Path1=%Path1%`nPath2=%Path2%`n`n
MsgBox, % p . "> RPath_Absolute(Path1, Path2)`n`n" . RPath_Absolute(Path1, Path2)