FileName

Encapsulate path and file names.

struct FileName {}

Constructors

this
this(const(char)[] str)

Members

Functions

equalsExt
bool equalsExt(const(char)* ext)

Return !=0 if extensions match.

ext
const(char)* ext()
Undocumented in source. Be warned that the author may not have intended to support it.
name
const(char)* name()
Undocumented in source. Be warned that the author may not have intended to support it.
opCast
bool opCast()
Undocumented in source. Be warned that the author may not have intended to support it.
toChars
const(char)* toChars()
Undocumented in source. Be warned that the author may not have intended to support it.
toString
const(char)[] toString()
Undocumented in source. Be warned that the author may not have intended to support it.

Static functions

absolute
bool absolute(const(char)[] name)

Determine if path is absolute.

addExt
char[] addExt(const(char)[] name, const(char)[] ext)

Add the extension ext to name, regardless of the content of name

buildPath
const(char)* buildPath(const(char)* path, const(char)*[] names)
Undocumented in source. Be warned that the author may not have intended to support it.
canonicalName
const(char)* canonicalName(const(char)* name)
const(char)[] canonicalName(const(char)[] name)

Return canonical version of name in a malloc'd buffer. This code is high risk.

combine
const(char)* combine(const(char)* path, const(char)* name)
const(char)[] combine(const(char)[] path, const(char)[] name)

Combine a path and a file name

defaultExt
const(char)* defaultExt(const(char)* name, const(char)* ext)
const(char)[] defaultExt(const(char)[] name, const(char)[] ext)

Free returned value with FileName::free()

ensurePathExists
bool ensurePathExists(const(char)[] path)
bool ensurePathExists(const(char)* path)

Ensure that the provided path exists

equals
bool equals(const(char)* name1, const(char)* name2)
bool equals(const(char)[] name1, const(char)[] name2)

Compare two name according to the platform's rules (case sensitive or not)

equalsExt
bool equalsExt(const(char)* name, const(char)* ext)
bool equalsExt(const(char)[] name, const(char)[] ext)
exists
int exists(const(char)* name)
int exists(const(char)[] name)

Check if the file the path points to exists

ext
const(char)[] ext(const(char)[] str)

Determine file name extension as slice of input.

forceExt
const(char)* forceExt(const(char)* name, const(char)* ext)
const(char)[] forceExt(const(char)[] name, const(char)[] ext)

Free returned value with FileName::free()

free
void free(const(char)* str)

Free memory allocated by FileName routines

name
const(char)* name(const(char)* str)
const(char)[] name(const(char)[] str)

Return filename name excluding path (read-only).

path
const(char)* path(const(char)* str)
const(char)[] path(const(char)[] str)

Return path portion of str. returned string is newly allocated Path does not include trailing path separator.

removeExt
const(char)* removeExt(const(char)* str)
const(char)[] removeExt(const(char)[] str)

Return file name without extension.

replaceName
const(char)[] replaceName(const(char)[] path, const(char)[] name)

Replace filename portion of path.

safeSearchPath
const(char)* safeSearchPath(Strings* path, const(char)* name)

Search Path for file in a safe manner.

searchPath
const(char)* searchPath(Strings* path, const(char)* name, bool cwd)

Search paths for file.

searchPath
const(char)[] searchPath(Strings* path, const(char)[] name, bool cwd)
Undocumented in source. Be warned that the author may not have intended to support it.
searchPath
const(char)[] searchPath(const(char)* path, const(char)[] name, bool cwd)
Undocumented in source. Be warned that the author may not have intended to support it.
splitPath
Strings* splitPath(const(char)* path)
Undocumented in source. Be warned that the author may not have intended to support it.
splitPath
void splitPath(int delegate(const(char)*) nothrow sink, const(char)* path)

Split path (such as that returned by getenv("PATH")) into pieces, each piece is mem.xmalloc'd Handle double quotes and ~. Pass the pieces to sink()

toAbsolute
const(char)* toAbsolute(const(char)* name, const(char)* base)

Return the given name as an absolute path

Meta