ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / WLanguage functions / Standard functions / External file functions
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
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.
Example
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>.
frelSubdirectoryOnlyGets 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>.
Component: wd290std.dll
Minimum version required
  • Version 28
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 07/21/2022

Send a report | Local help