Sign in Join
FPDoc Onlineexperiment

CreateRelativeSearchPath function

In unit LazFileUtils

Resolves relative path value(s) in the specified search path.

Declaration

pascal
function CreateRelativeSearchPath(const SearchPath: string; 
 const BaseDirectory: string): string

Description

CreateRelativeSearchPath is a String function used to resolve one or more paths in SearchPath relative to the directory specified in BaseDirectory. A relative search path is one that assumes the path starts at a given working directory, and could result in an error if that directory is not the current directory on the local file system. CreateRelativeSearchPath ensures that a relative search path is resolved relative to a given directory to provide access to resources in the directory path.

SearchPath can contain multiple path values by using the semicolon character (;) to separate the paths.

BaseDirectory specifies the directory used as the anchor (or root) for each resolved search path.

Paths specified in SearchPath are resolved individually, and recombined with other path values in SearchPath. If either SearchPath or BaseDirectory contain an empty string (''), no actions are performed in the function. The return value contains a copy of the contents in SearchPath with relative paths resolved.

See also

An experiment, built from Lazarus main 2dfa93c66e of 10-22-2026. Not the official Lazarus documentation.