Package: glib

Function g-path-is-absolute

Lambda List

g-path-is-absolute (file-name)

Arguments

file-name -- a string with a file name

Return Value

True if file-name is absolute.

Details

Returns true if the given file-name is an absolute file name. Note that this is a somewhat vague concept on Windows.

On POSIX systems, an absolute file name is well-defined. It always starts from the single root directory. For example "/usr/local".

On Windows, the concepts of current drive and drive-specific current directory introduce vagueness. This function interprets as an absolute file name one that either begins with a directory separator such as "Userstml" or begins with the root on a drive, for example "C:Windows". The first case also includes UNC paths such as "\myserverdocsfoo". In all cases, either slashes or backslashes are accepted.

Note that a file name relative to the current drive root does not truly specify a file uniquely over time and across processes, as the current drive is a per-process value and can be changed.

File names relative the current directory on some specific drive, such as "D:foo/bar", are not interpreted as absolute by this function, but they obviously are not relative to the normal current directory as returned by getcwd() or the function g-current-dir either. Such paths should be avoided, or need to be handled using Windows-specific code.
 

See also

2020-10-24