fBuildRelativePath (Function) In french: fRelativise Returns the path to a file relative to a reference directory. This relative path is built from the full path of the file.
Trace(fBuildRelativePath("c:\dir1\dir2\dir3\file.txt", "c:\dir1\dir2")) // Returns ".\dir3\file.txt" Trace(fBuildRelativePath("c:\dir1\dir2\dir3\file.txt", "c:\dir1\dir2", frelSubdirectoryOnly)) // Returns ".\dir3\file.txt" Trace(fBuildRelativePath("c:\dir1\dir2\dir3\file.txt", "c:\dir1\dirB")) // Returns "..\dir2\dir3\file.txt" Trace(fBuildRelativePath("c:\dir1\dir2\dir3\file.txt", "c:\dir1\dirB", frelSubdirectoryOnly)) // Returns "c:\dir1\dir2\dir3\file.txt"
Syntax
<Result> = fBuildRelativePath(<File path> , <Reference path> [, <Mode>])
<Result>: Character string - Relative path of the file,
- Original path of the file if the relative path cannot be built.
<File path>: Character string Full path of the file for which the relative path should be built. Remark: In Windows, if the <File path> and <Reference path> do not have the same drive letter, <Result> will be <Reference path>. <Reference path>: Character string Path of the directory used as reference for building the relative path.Remark: In Windows, if the <File path> and <Reference path> do not have the same drive letter, <Result> will be <Reference path>. <Mode>: Optional Integer constant Mode for building the relative path: | | frelAll (Default value) | Gets the path relative to the <Reference path>. | frelSubdirectoryOnly | Gets the path relative to the <Reference path>. If this constant is used, the <File path> parameter must be a subdirectory of the <Reference path>. Otherwise, <Result> will be <Reference path>. |
This page is also available for…
|
|
|
|