ae.utils.path

ae.utils.path

Members

Aliases

fastRelativePath
deprecated alias fastRelativePath = relPath
Undocumented in source.

Functions

excludeTrailingPathSeparator
string excludeTrailingPathSeparator(string path)

Like Pascal's ExcludeTrailingPathDelimiter

findExecutable
string findExecutable(string name, string[] dirs)

Find an executable with the given name (no extension) in the given directories. Returns null if not found.

findProgramDirectory
string findProgramDirectory(string testFile, string sourceFile)

Find a program's "home" directory, based on the presence of a file.

haveExecutable
bool haveExecutable(string name)

Returns true if a program with the given name can be found in PATH.

includeTrailingPathSeparator
string includeTrailingPathSeparator(string path)

Like Pascal's IncludeTrailingPathDelimiter

pathStartsWith
bool pathStartsWith(char[] path, char[] prefix)

Like startsWith, but pathStartsWith("/foo/barbara", "/foo/bar") is false.

rebasePath
string rebasePath(string path, string oldBase, string newBase)

Modify a path under oldBase to a new path with the same subpath under newBase. E.g.: /foo/bar.rebasePath(/foo, /quux) == /quux/bar

relPath
string relPath(string path, string base)

Variant of std.path.relativePath with the following differences: - Works with relative paths. If either path is relative, it is first resolved to an absolute path. - If path starts with base, avoids allocating.

Manifest constants

nullFileName
enum nullFileName;
Undocumented in source.
nullFileName
enum nullFileName;
Undocumented in source.

Properties

pathDirs
string[] pathDirs [@property getter]

Return the PATH environment variable, split into individual paths.

Meta

License

This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.

Authors

Vladimir Panteleev <ae@cy.md>