RPath

作者: toralf, Titan 最近更新时间: 20070525


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

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

关于函数的参数和返回值, 请参阅其源码或 此文档.

备注

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()

关于此函数(集)的更新细节和注意事项, 请参见 AutoHotkey 论坛: http://www.autohotkey.com/forum/topic19489.html

许可

不存在

示例

; #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)