scriptlike.path



bool scriptlikeEcho;
If true, all commands will be echoed. By default, they will be

echoed to stdout, but you can override this with scriptlikeCustomEcho.

alias scriptlikeTraceCommands = scriptlikeEcho;
Alias for backwards-compatibility. This will be deprecated in the future.

You should use scriptlikeEcho insetad.

bool scriptlikeDryRun;
If true, then run, tryRun, file write, file append, and all the echoable commands that modify the filesystem will be echoed to stdout (regardless of scriptlikeEcho) and NOT actually executed.

Warning! This is NOT a "set it and forget it" switch. You must still take care to write your script in a way that's dryrun-safe. Two things to remember:

1. ONLY Scriptlike's functions will obey this setting. Calling Phobos functions directly will BYPASS this setting.

2. If part of your script relies on a command having ACTUALLY been run, then that command will fail. You must avoid that situation or work around it. For example:

run(`date > tempfile`);

// The following will FAIL or behave INCORRECTLY in dryrun mode:
auto data = cast(string)read("tempfile");
run("echo "~data);


That may be an unrealistic example, but it demonstrates the problem: Normally, the code above should run fine (at least on posix). But in dryrun mode, "date" will not actually be run. Therefore, tempfile will neither be created nor overwritten. Result: Either an exception reading a non-existent file, or outdated information will be displayed.

Scriptlike cannot anticipate or handle such situations. So it's up to you to make sure your script is dryrun-safe.

void delegate(string) scriptlikeCustomEcho;
By default, scriptlikeEcho and scriptlikeDryRun echo to stdout. You can override this behavior by setting scriptlikeCustomEcho to your own sink delegate. Set this to null to go back to Scriptlike's default of "echo to stdout" again.

Note, setting this does not automatically enable echoing. You still need to set either scriptlikeEcho or scriptlikeDryRun to true.

class ErrorLevelException: object.Exception;
Indicates a command returned a non-zero errorlevel.

struct ExtT(C = char) if (is(C == char) || is(C == wchar) || is(C == dchar));
alias Ext = ExtT!char.ExtT;
alias WExt = ExtT!wchar.ExtT;
alias DExt = ExtT!dchar.ExtT;
Represents a file extension.

this(immutable(C)[] extension = null);
Main constructor.

string toString();
Convert to string.

immutable(C)[] toRawString();
Convert to string, wstring or dstring, depending on the type of Ext.

const int opCmp(ref const ExtT!C other);
const int opCmp(ExtT!C other);
const int opCmp(string other);
Compare using OS-specific case-sensitivity rules. If you want to force

case-sensitive or case-insensistive, then call filenameCmp instead.

const int opEquals(ref const ExtT!C other);
const int opEquals(ExtT!C other);
const int opEquals(string other);
Compare using OS-specific case-sensitivity rules. If you want to force

case-sensitive or case-insensistive, then call filenameCmp instead.

T opCast(T)() if (is(T == bool));
Convert to bool

struct PathT(C = char) if (is(C == char));
alias Path = PathT!char.PathT;
Represents a filesystem path. The path is always kept normalized

automatically (as performed by buildNormalizedPathFixed).





wchar and dchar versions not yet supported, blocked by DMD issue #12112

pure nothrow @safe this()(const(C)[] path = ".");
Main constructor.

this(T)(T[] path = ".") if (isSomeChar!T);
Convert from one type of Path to another.

Example:
auto pathStr = Path("foo"); auto pathWStr = PathT!wchar(pathStr); auto pathDStr = PathT!dchar(pathStr); pathStr = Path(pathWStr); pathStr = Path(pathDStr);

string toString();
Convert to string, quoting or escaping spaces if necessary.

immutable(C)[] toRawString();
Convert to string, wstring or dstring, depending on the type of Path.

Does NOT do any escaping, even if path contains spaces.

PathT!C opBinary(string op)(PathT!C rhs) if (op == "~");
PathT!C opBinary(string op)(const(C)[] rhs) if (op == "~");
PathT!C opBinaryRight(string op)(const(C)[] lhs) if (op == "~");
Concatenates two paths, with a directory separator in between.

PathT!C opBinary(string op)(ExtT!C rhs) if (op == "~");
Appends an extension to a path. Naturally, a directory separator

is NOT inserted in between.

PathT!C opOpAssign(string op)(PathT!C rhs) if (op == "~");
PathT!C opOpAssign(string op)(const(C)[] rhs) if (op == "~");
Appends a path to this one, with a directory separator in between.

PathT!C opOpAssign(string op)(ExtT!C rhs) if (op == "~");
Appends an extension to this path. Naturally, a directory separator

is NOT inserted in between.

const int opCmp(ref const PathT!C other);
const int opCmp(PathT!C other);
const int opCmp(string other);
Compare using OS-specific case-sensitivity rules. If you want to force

case-sensitive or case-insensistive, then call filenameCmp instead.

const int opEquals(ref const PathT!C other);
const int opEquals(PathT!C other);
const int opEquals(string other);
Compare using OS-specific case-sensitivity rules. If you want to force

case-sensitive or case-insensistive, then call filenameCmp instead.

T opCast(T)() if (is(T == bool));
Convert to bool

@property PathT!C up();
Returns the parent path, according to std.path.dirName.

@property bool empty();
Is this path equal to empty string?

alias extOf = extension(C)(in PathT!C path);
alias stripExt = stripExtension(C)(PathT!C path);
alias setExt = setExtension(C, C2)(PathT!C path, const(C2)[] ext) if (is(C == Unqual!C2));
alias defaultExt = defaultExtension(C, C2)(PathT!C path, in C2[] ext) if (is(C == Unqual!C2));
Convenience aliases

@trusted bool existsAsDir()(in char[] path);
@trusted bool existsAsDir(C)(in PathT!C path) if (isSomeChar!C);
Checks if the path exists as a directory.

This is like std.file.isDir, but returns false instead of throwing if the

path doesn't exist.

@trusted bool existsAsFile()(in char[] path);
@trusted bool existsAsFile(C)(in PathT!C path) if (isSomeChar!C);
Checks if the path exists as a file.

This is like std.file.isFile, but returns false instead of throwing if the

path doesn't exist.

@trusted bool existsAsSymlink()(in char[] path);
@trusted bool existsAsSymlink(C)(in PathT!C path) if (isSomeChar!C);
Checks if the path exists as a symlink.

This is like std.file.isSymlink, but returns false instead of throwing if the

path doesn't exist.

pure nothrow @trusted immutable(C)[] buildNormalizedPathFixed(C)(const(C[])[] paths...) if (isSomeChar!C);
Like buildNormalizedPath, but if the result is the current directory,

this returns "." instead of "". However, if all the inputs are "", or there

are no inputs, this still returns "" just like buildNormalizedPath.

string escapeShellArg(T)(T str) if (isSomeString!T);
Properly escape arguments containing spaces for the command shell, if necessary.

void run()(string command);
void run(C)(PathT!C workingDirectory, string command);
Runs a command, through the system's command shell interpreter, in typical shell-script style: Synchronously, with the command's stdout/in/err automatically forwarded through your program's stdout/in/err.

Optionally takes a working directory to run the command from.

The command is echoed if scriptlikeEcho is true.

ErrorLevelException is thrown if the process returns a non-zero error level. If you want to handle the error level yourself, use tryRun instead of run.

Example:
Args cmd;
cmd ~= Path("some tool");
cmd ~= "-o";
cmd ~= Path(`dir/out file.txt`);
cmd ~= ["--abc", "--def", "-g"];
Path("some working dir").run(cmd.data);


int tryRun()(string command);
int tryRun(C)(PathT!C workingDirectory, string command);
Runs a command, through the system's command shell interpreter, in typical shell-script style: Synchronously, with the command's stdout/in/err automatically forwarded through your program's stdout/in/err.

Optionally takes a working directory to run the command from.

The command is echoed if scriptlikeEcho is true.

Returns:
The error level the process exited with.

Example:
Args cmd;
cmd ~= Path("some tool");
cmd ~= "-o";
cmd ~= Path(`dir/out file.txt`);
cmd ~= ["--abc", "--def", "-g"];
auto errLevel = Path("some working dir").run(cmd.data);


alias runShell = tryRun()(string command);
Backwards-compatibility alias. runShell may become depricated in the

future, so you should use tryRun or run insetad.

alias dirSeparator = std.path.dirSeparator;
alias pathSeparator = std.path.pathSeparator;
alias isDirSeparator = std.path.isDirSeparator;
alias CaseSensitive = std.path.CaseSensitive;
alias osDefaultCaseSensitivity = std.path.osDefaultCaseSensitivity;
alias buildPath = std.path.buildPath(Range)(Range segments) if (isInputRange!Range && isSomeString!(ElementType!Range));
alias buildNormalizedPath = std.path.buildNormalizedPath(C)(const(C[])[] paths...) if (isSomeChar!C);
Part of workaround for DMD Issue #12111

pure @trusted PathT!C baseName(C)(PathT!C path);
pure @safe PathT!C baseName(CaseSensitive cs = CaseSensitive.osDefault, C, C1)(PathT!C path, in C1[] suffix) if (isSomeChar!C1);
Just like std.path.baseName, but operates on Path.

pure @trusted inout(C)[] baseName(C)(inout(C)[] path) if (isSomeChar!C);
pure @safe inout(C)[] baseName(CaseSensitive cs = CaseSensitive.osDefault, C, C1)(inout(C)[] path, in C1[] suffix) if (isSomeChar!C && isSomeChar!C1);
Part of workaround for DMD Issue #12111

PathT!C dirName(C)(PathT!C path) if (isSomeChar!C);
Just like std.path.dirName, but operates on Path.

C[] dirName(C)(C[] path) if (isSomeChar!C);
Part of workaround for DMD Issue #12111

pure nothrow @safe PathT!C rootName(C)(PathT!C path);
Just like std.path.rootName, but operates on Path.

pure nothrow @safe inout(C)[] rootName(C)(inout(C)[] path) if (isSomeChar!C);
Part of workaround for DMD Issue #12111

pure nothrow @safe PathT!C driveName(C)(PathT!C path);
Just like std.path.driveName, but operates on Path.

pure nothrow @safe inout(C)[] driveName(C)(inout(C)[] path) if (isSomeChar!C);
Part of workaround for DMD Issue #12111

pure nothrow @safe PathT!C stripDrive(C)(PathT!C path);
Just like std.path.stripDrive, but operates on Path.

pure nothrow @safe inout(C)[] stripDrive(C)(inout(C)[] path) if (isSomeChar!C);
Part of workaround for DMD Issue #12111

pure nothrow @safe ExtT!C extension(C)(in PathT!C path);
Just like std.path.extension, but takes a Path and returns an Ext.

pure nothrow @safe inout(C)[] extension(C)(inout(C)[] path) if (isSomeChar!C);
Part of workaround for DMD Issue #12111

pure nothrow @safe PathT!C stripExtension(C)(PathT!C path);
Just like std.path.stripExtension, but operates on Path.

pure nothrow @safe inout(C)[] stripExtension(C)(inout(C)[] path) if (isSomeChar!C);
Part of workaround for DMD Issue #12111

pure nothrow @trusted PathT!C setExtension(C, C2)(PathT!C path, const(C2)[] ext) if (is(C == Unqual!C2));
pure nothrow @trusted PathT!C setExtension(C)(PathT!C path, ExtT!C ext);
Just like std.path.setExtension, but operates on Path.

pure nothrow @trusted immutable(Unqual!C1)[] setExtension(C1, C2)(in C1[] path, in C2[] ext) if (isSomeChar!C1 && !is(C1 == immutable) && is(Unqual!C1 == Unqual!C2));
Part of workaround for DMD Issue #12111

pure nothrow @trusted immutable(C1)[] setExtension(C1, C2)(immutable(C1)[] path, const(C2)[] ext) if (isSomeChar!C1 && is(Unqual!C1 == Unqual!C2));
Part of workaround for DMD Issue #12111

pure @trusted PathT!C defaultExtension(C, C2)(PathT!C path, in C2[] ext) if (is(C == Unqual!C2));
pure @trusted PathT!C defaultExtension(C)(PathT!C path, ExtT!C ext);
Just like std.path.defaultExtension, but operates on Path and optionally Ext.

pure @trusted immutable(Unqual!C1)[] defaultExtension(C1, C2)(in C1[] path, in C2[] ext) if (isSomeChar!C1 && is(Unqual!C1 == Unqual!C2));
Part of workaround for DMD Issue #12111

pure nothrow @safe auto pathSplitter(C)(PathT!C path);
Just like std.path.pathSplitter. Note this returns a range of strings,

not a range of Path.

pure nothrow @safe ReturnType!(std.path.pathSplitter!C) pathSplitter(C)(const(C)[] path) if (isSomeChar!C);
Part of workaround for DMD Issue #12111

pure nothrow @safe bool isRooted(C)(in PathT!C path);
Just like std.path.isRooted, but operates on Path.

pure nothrow @safe bool isRooted(C)(in C[] path) if (isSomeChar!C);
Part of workaround for DMD Issue #12111

pure nothrow @safe bool isAbsolute(C)(in PathT!C path);
Just like std.path.isAbsolute, but operates on Path.

pure nothrow @safe bool isAbsolute(C)(in C[] path) if (isSomeChar!C);
Part of workaround for DMD Issue #12111

pure @safe PathT!C absolutePath(C)(PathT!C path, lazy string base = getcwd());
pure @safe PathT!C absolutePath(C)(PathT!C path, PathT!C base);
Just like std.path.absolutePath, but operates on Path.

pure @safe string absolutePath(string path, lazy string base = getcwd());
Part of workaround for DMD Issue #12111

PathT!C relativePath(CaseSensitive cs = CaseSensitive.osDefault, C)(PathT!C path, lazy string base = getcwd());
PathT!C relativePath(CaseSensitive cs = CaseSensitive.osDefault, C)(PathT!C path, PathT!C base);
Just like std.path.relativePath, but operates on Path.

string relativePath(CaseSensitive cs = CaseSensitive.osDefault)(string path, lazy string base = getcwd());
Part of workaround for DMD Issue #12111

pure nothrow @safe int filenameCharCmp(CaseSensitive cs = CaseSensitive.osDefault)(dchar a, dchar b);
Part of workaround for DMD Issue #12111

pure @safe int filenameCmp(CaseSensitive cs = CaseSensitive.osDefault, C, C2)(PathT!C path, PathT!C2 filename2);
pure @safe int filenameCmp(CaseSensitive cs = CaseSensitive.osDefault, C, C2)(PathT!C path, const(C2)[] filename2) if (isSomeChar!C2);
pure @safe int filenameCmp(CaseSensitive cs = CaseSensitive.osDefault, C, C2)(const(C)[] path, PathT!C2[] filename2) if (isSomeChar!C);
Just like std.path.filenameCmp, but operates on Path.

pure @safe int filenameCmp(CaseSensitive cs = CaseSensitive.osDefault, C1, C2)(const(C1)[] filename1, const(C2)[] filename2) if (isSomeChar!C1 && isSomeChar!C2);
Part of workaround for DMD Issue #12111

pure nothrow @safe bool globMatch(CaseSensitive cs = CaseSensitive.osDefault, C)(PathT!C path, const(C)[] pattern);
Just like std.path.globMatch, but operates on Path.

pure nothrow @safe bool globMatch(CaseSensitive cs = CaseSensitive.osDefault, C)(const(C)[] path, const(C)[] pattern) if (isSomeChar!C);
Part of workaround for DMD Issue #12111

pure nothrow @safe bool isValidFilename(C)(in PathT!C path);
Just like std.path.isValidFilename, but operates on Path.

pure nothrow @safe bool isValidFilename(C)(in C[] filename) if (isSomeChar!C);
Part of workaround for DMD Issue #12111

pure nothrow @safe bool isValidPath(C)(in PathT!C path);
Just like std.path.isValidPath, but operates on Path.

pure nothrow @safe bool isValidPath(C)(in C[] path) if (isSomeChar!C);
Part of workaround for DMD Issue #12111

PathT!C expandTilde(C)(PathT!C path);
Just like std.path.expandTilde, but operates on Path.

string expandTilde(string inputPath);
Part of workaround for DMD Issue #12111

alias FileException = std.file.FileException;
Part of workaround for DMD Issue #12111

void[] read(C)(in PathT!C name, size_t upTo = size_t.max) if (isSomeChar!C);
Just like std.file.read, but takes a Path.

void[] read(in char[] name, size_t upTo = size_t.max);
Part of workaround for DMD Issue #12111

template readText(S = string)
Just like std.file.readText, but takes a Path.

S readText(S = string)(in char[] name);
Part of workaround for DMD Issue #12111

void write(C)(in PathT!C name, const void[] buffer) if (isSomeChar!C);
void write(in char[] name, const void[] buffer);
Just like std.file.write, but optionally takes a Path,

and obeys scriptlikeEcho and scriptlikeDryRun.

void append(C)(in PathT!C name, in void[] buffer) if (isSomeChar!C);
void append(in char[] name, in void[] buffer);
Just like std.file.append, but optionally takes a Path,

and obeys scriptlikeEcho and scriptlikeDryRun.

void rename(C)(in PathT!C from, in PathT!C to) if (isSomeChar!C);
void rename(C)(in char[] from, in PathT!C to) if (isSomeChar!C);
void rename(C)(in PathT!C from, in char[] to) if (isSomeChar!C);
void rename(in char[] from, in char[] to);
Just like std.file.rename, but optionally takes Path,

and obeys scriptlikeEcho and scriptlikeDryRun.

bool tryRename(T1, T2)(T1 from, T2 to);
If 'from' exists, then rename. Otherwise do nothing.

Obeys scriptlikeEcho and scriptlikeDryRun.

Returns:
Success?

void remove(C)(in PathT!C name) if (isSomeChar!C);
void remove(in char[] name);
Just like std.file.remove, but optionally takes a Path,

and obeys scriptlikeEcho and scriptlikeDryRun.

bool tryRemove(T)(T name);
If 'name' exists, then remove. Otherwise do nothing.

Obeys scriptlikeEcho and scriptlikeDryRun.

Returns:
Success?

ulong getSize(C)(in PathT!C name) if (isSomeChar!C);
Just like std.file.getSize, but takes a Path.

ulong getSize(in char[] name);
Part of workaround for DMD Issue #12111

void getTimes(C)(in PathT!C name, out SysTime accessTime, out SysTime modificationTime) if (isSomeChar!C);
Just like std.file.getTimes, but takes a Path.

void getTimes(in char[] name, out SysTime accessTime, out SysTime modificationTime);
Part of workaround for DMD Issue #12111

void getTimesWin(C)(in PathT!C name, out SysTime fileCreationTime, out SysTime fileAccessTime, out SysTime fileModificationTime) if (isSomeChar!C);
Windows-only. Just like std.file.getTimesWin, but takes a Path.

void getTimesWin(in char[] name, out SysTime fileCreationTime, out SysTime fileAccessTime, out SysTime fileModificationTime);
Windows-only. Part of workaround for DMD Issue #12111

void setTimes(C)(in PathT!C name, SysTime accessTime, SysTime modificationTime) if (isSomeChar!C);
void setTimes(in char[] name, SysTime accessTime, SysTime modificationTime);
Just like std.file.setTimes, but optionally takes a Path,

and obeys scriptlikeEcho and scriptlikeDryRun.

SysTime timeLastModified(C)(in PathT!C name) if (isSomeChar!C);
Just like std.file.timeLastModified, but takes a Path.

SysTime timeLastModified(C)(in PathT!C name, SysTime returnIfMissing) if (isSomeChar!C);
Just like std.file.timeLastModified, but takes a Path.

SysTime timeLastModified(in char[] name);
SysTime timeLastModified(in char[] name, SysTime returnIfMissing);
Part of workaround for DMD Issue #12111

@trusted bool exists(C)(in PathT!C name) if (isSomeChar!C);
Just like std.file.exists, but takes a Path.

@trusted bool exists(in char[] name);
Part of workaround for DMD Issue #12111

uint getAttributes(C)(in PathT!C name) if (isSomeChar!C);
Just like std.file.getAttributes, but takes a Path.

uint getAttributes(in char[] name);
Part of workaround for DMD Issue #12111

uint getLinkAttributes(C)(in PathT!C name) if (isSomeChar!C);
Just like std.file.getLinkAttributes, but takes a Path.

uint getLinkAttributes(in char[] name);
Part of workaround for DMD Issue #12111

@property bool isDir(C)(in PathT!C name) if (isSomeChar!C);
Just like std.file.isDir, but takes a Path.

@property bool isDir(in char[] name);
Part of workaround for DMD Issue #12111

@property bool isFile(C)(in PathT!C name) if (isSomeChar!C);
Just like std.file.isFile, but takes a Path.

@property bool isFile(in char[] name);
Part of workaround for DMD Issue #12111

@property bool isSymlink(C)(PathT!C name) if (isSomeChar!C);
Just like std.file.isSymlink, but takes a Path.

@property bool isSymlink(C)(const(C)[] name);
Part of workaround for DMD Issue #12111

void chdir(C)(in PathT!C pathname) if (isSomeChar!C);
Just like std.file.chdir, but takes a Path, and echoes if scriptlikeEcho is true.

void chdir(in char[] pathname);
Just like std.file.chdir, but echoes if scriptlikeEcho is true.

void mkdir(C)(in PathT!C pathname) if (isSomeChar!C);
void mkdir(in char[] pathname);
Just like std.file.mkdir, but optionally takes a Path,

and obeys scriptlikeEcho and scriptlikeDryRun.

bool tryMkdir(T)(T name);
If 'name' doesn't already exist, then mkdir. Otherwise do nothing.

Obeys scriptlikeEcho and scriptlikeDryRun.

Returns:
Success?

void mkdirRecurse(C)(in PathT!C pathname) if (isSomeChar!C);
void mkdirRecurse(in char[] pathname);
Just like std.file.mkdirRecurse, but optionally takes a Path,

and obeys scriptlikeEcho and scriptlikeDryRun.

bool tryMkdirRecurse(T)(T name);
If 'name' doesn't already exist, then mkdirRecurse. Otherwise do nothing.

Obeys scriptlikeEcho and scriptlikeDryRun.

Returns:
Success?

void rmdir(C)(in PathT!C pathname) if (isSomeChar!C);
void rmdir(in char[] pathname);
Just like std.file.rmdir, but optionally takes a Path,

and obeys scriptlikeEcho and scriptlikeDryRun.

bool tryRmdir(T)(T name);
If 'name' exists, then rmdir. Otherwise do nothing.

Obeys scriptlikeEcho and scriptlikeDryRun.

Returns:
Success?

void symlink(C1, C2)(PathT!C1 original, PathT!C2 link) if (isSomeChar!C1 && isSomeChar!C2);
void symlink(C1, C2)(const(C1)[] original, PathT!C2 link) if (isSomeChar!C1 && isSomeChar!C2);
void symlink(C1, C2)(PathT!C1 original, const(C2)[] link) if (isSomeChar!C1 && isSomeChar!C2);
void symlink(C1, C2)(const(C1)[] original, const(C2)[] link);
Posix-only. Just like std.file.symlink, but optionally takes Path,

and obeys scriptlikeEcho and scriptlikeDryRun.

bool trySymlink(T1, T2)(T1 original, T2 link);
Posix-only. If 'original' exists, then symlink. Otherwise do nothing.

Obeys scriptlikeEcho and scriptlikeDryRun.

Returns:
Success?

PathT!C readLink(C)(PathT!C link) if (isSomeChar!C);
Posix-only. Just like std.file.readLink, but operates on Path.

string readLink(C)(const(C)[] link);
Posix-only. Part of workaround for DMD Issue #12111

void copy(C)(in PathT!C from, in PathT!C to) if (isSomeChar!C);
void copy(C)(in char[] from, in PathT!C to) if (isSomeChar!C);
void copy(C)(in PathT!C from, in char[] to) if (isSomeChar!C);
void copy(in char[] from, in char[] to);
Just like std.file.copy, but optionally takes Path,

and obeys scriptlikeEcho and scriptlikeDryRun.

bool tryCopy(T1, T2)(T1 from, T2 to);
If 'from' exists, then copy. Otherwise do nothing.

Obeys scriptlikeEcho and scriptlikeDryRun.

Returns:
Success?

void rmdirRecurse(C)(in PathT!C pathname) if (isSomeChar!C);
void rmdirRecurse(in char[] pathname);
Just like std.file.rmdirRecurse, but optionally takes a Path,

and obeys scriptlikeEcho and scriptlikeDryRun.

bool tryRmdirRecurse(T)(T name);
If 'name' exists, then rmdirRecurse. Otherwise do nothing.

Obeys scriptlikeEcho and scriptlikeDryRun.

Returns:
Success?

auto dirEntries(C)(PathT!C path, SpanMode mode, bool followSymlink = true) if (isSomeChar!C);
Just like std.file.dirEntries, but takes a Path.

auto dirEntries(C)(PathT!C path, string pattern, SpanMode mode, bool followSymlink = true) if (isSomeChar!C);
Just like std.file.dirEntries, but takes a Path.

auto dirEntries(string path, SpanMode mode, bool followSymlink = true);
auto dirEntries(string path, string pattern, SpanMode mode, bool followSymlink = true);
Part of workaround for DMD Issue #12111

template slurp(Types...)
Just like std.file.slurp, but takes a Path.

Select!(Types.length == 1, Types[0][], Tuple!Types[]) slurp(Types...)(string filename, in char[] format);
Part of workaround for DMD Issue #12111

struct ArgsT(C = char) if (is(C == char));
alias Args = ArgsT!char.ArgsT;
Much like std.array.Appender!string, but specifically geared towards building a command string out of arguments. String and Path can both be appended. All elements added will automatically be escaped, and separated by spaces, as necessary.

Example:
Args args;
args ~= Path(`some/big path/here/foobar`);
args ~= "-A";
args ~= "--bcd";
args ~= "Hello World";
args ~= Path("file.ext");

// On windows:
assert(args.data == `"some\big path\here\foobar" -A --bcd "Hello World" file.ext`);
// On linux:
assert(args.data == `'some/big path/here/foobar' -A --bcd 'Hello World' file.ext`);


wchar and dchar versions not yet supported, blocked by DMD issue #12112


Page generated by Ddoc.