nxt.file

Extensions to std.file.

Members

Functions

cacheHomeDir
DirPath cacheHomeDir()

Get path to the default cache (home) directory. See: XDG_CACHE_HOME See: https://specifications.freedesktop.org/basedir-spec/latest/

copyRecurse
void copyRecurse(const(char)[] from, const(char)[] to, PreserveAttributes preserve)
void copyRecurse(DirPath from, DirPath to, PreserveAttributes preserve)

Copy directory from to to recursively.

dirEntries
void dirEntries(DirPath root, ScanFlags scanFlags, ScanFlags.Depth depth)

Directory Scanning Flags|Options.

dirEntries
void dirEntries(char[] root, ScanFlags scanFlags, ScanFlags.Depth depth)
Undocumented in source. Be warned that the author may not have intended to support it.
findExecutable
FilePath findExecutable(FileName a, const(char)[] pathVariableName)

Find path for a (or FilePath.init if not found) in pathVariableName. TODO: Add caching of result and detect changes via inotify.

findFileInPath
FilePath findFileInPath(FileName a, const(char)[] pathVariableName, bool onlyExecutable)

Find path for a (or FilePath.init if not found) in pathVariableName. TODO: Add caching of result and detect changes via inotify.

homeDir
DirPath homeDir()

Get path to home directory.

matchFirst
typeof(FileName.str) matchFirst(FileName input, PNode node)
Undocumented in source. Be warned that the author may not have intended to support it.
rawReadZ
immutable(void)[] rawReadZ(FilePath path)
immutable(void)[] rawReadZ(File file)

Read file path into raw array with one extra terminating zero byte.

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

Variant of std.file.remove() that returns status instead of throwing.

rmdirRecurseForced
void rmdirRecurseForced(DirPath path, bool followSymlink)
void rmdirRecurseForced(char[] path, bool followSymlink)
void rmdirRecurseForced(DirEntry de, bool followSymlink)

Identical to std.file.rmdirRecurse on POSIX. On Windows it removes read-only bits before deleting. TODO: Integrate into Phobos as rmdirRecurse(bool forced). TODO: Make a non-throwing version bool tryRmdirRecurse(bool forced).

tempDir
DirPath tempDir()

Get path to default temporary directory.

tempSubFilePath
string tempSubFilePath(string prefix, string extension)

Returns the path to a new (unique) temporary file under tempDir.

tempfile
int tempfile(char[] namePrefix)

Create a new temporary file starting with ($D namePrefix) and ending with 6 randomly defined characters.

temptree
char* temptree(char* name_x, char* template_)

Create a New Temporary Directory Tree.

Static functions

fileExtension
PNode fileExtension(string s)

Get pattern that matches a file name ending with '.'~s.

Structs

DataFormat
struct DataFormat

(Data) Format of file contents.

FileExtension
struct FileExtension

Extension of filename. See: https://en.wikipedia.org/wiki/Filename_extension

FileType
struct FileType

Type of file.

ScanFlags
struct ScanFlags

Directory Scanning Flags|Options.

Meta