scriptlike.file

Members

Aliases

scriptlikeTraceCommands
alias scriptlikeTraceCommands = scriptlikeEcho

Alias for backwards-compatibility. This will be deprecated in the future. You should use scriptlikeEcho insetad.

Functions

append
void append(Path name, void[] buffer)
void append(string name, void[] buffer)

Just like std.file.append, but optionally takes a Path, and obeys scriptlikeEcho and scriptlikeDryRun.

chdir
void chdir(Path pathname)

Just like std.file.chdir, but takes a Path, and echoes if scriptlikeEcho is true.

chdir
void chdir(string pathname)

Just like std.file.chdir, but echoes if scriptlikeEcho is true.

copy
void copy(Path from, Path to)
void copy(string from, Path to)
void copy(Path from, string to)
void copy(string from, string to)

Just like std.file.copy, but optionally takes Path, and obeys scriptlikeEcho and scriptlikeDryRun.

dirEntries
auto dirEntries(Path path, SpanMode mode, bool followSymlink)

Just like std.file.dirEntries, but takes a Path.

dirEntries
auto dirEntries(Path path, string pattern, SpanMode mode, bool followSymlink)

Just like std.file.dirEntries, but takes a Path.

echoCommand
void echoCommand(string msg)

Output a (lazy) string through scriptlike's echo logger. Does nothing if scriptlikeEcho and scriptlikeDryRun are both false.

exists
bool exists(Path name)

Just like std.file.exists, but takes a Path.

existsAsDir
bool existsAsDir(string path)
bool existsAsDir(Path path)

Checks if the path exists as a directory.

existsAsFile
bool existsAsFile(string path)
bool existsAsFile(Path path)

Checks if the path exists as a file.

existsAsSymlink
bool existsAsSymlink(string path)
bool existsAsSymlink(Path path)

Checks if the path exists as a symlink.

getAttributes
uint getAttributes(Path name)

Just like std.file.getAttributes, but takes a Path.

getLinkAttributes
uint getLinkAttributes(Path name)

Just like std.file.getLinkAttributes, but takes a Path.

getSize
ulong getSize(Path name)

Just like std.file.getSize, but takes a Path.

getTimes
void getTimes(Path name, SysTime accessTime, SysTime modificationTime)

Just like std.file.getTimes, but takes a Path.

getTimesWin
void getTimesWin(Path name, SysTime fileCreationTime, SysTime fileAccessTime, SysTime fileModificationTime)

Windows-only. Just like std.file.getTimesWin, but takes a Path.

getTimesWin
void getTimesWin(Path name, SysTime fileCreationTime, SysTime fileAccessTime, SysTime fileModificationTime)
Undocumented in source. Be warned that the author may not have intended to support it.
getcwd
Path getcwd()

Just like std.file.getcwd, but returns a Path.

mkdir
void mkdir(Path pathname)
void mkdir(string pathname)

Just like std.file.mkdir, but optionally takes a Path, and obeys scriptlikeEcho and scriptlikeDryRun.

mkdirRecurse
void mkdirRecurse(Path pathname)
void mkdirRecurse(string pathname)

Just like std.file.mkdirRecurse, but optionally takes a Path, and obeys scriptlikeEcho and scriptlikeDryRun.

read
void[] read(Path name, size_t upTo)

Just like std.file.read, but takes a Path.

readLink
Path readLink(Path link)

Posix-only. Just like std.file.readLink, but operates on Path.

readLink
Path readLink(Path link)
Undocumented in source. Be warned that the author may not have intended to support it.
readText
S readText(Path name)

Just like std.file.readText, but takes a Path.

remove
void remove(Path name)
void remove(string name)

Just like std.file.remove, but optionally takes a Path, and obeys scriptlikeEcho and scriptlikeDryRun.

rename
void rename(Path from, Path to)
void rename(string from, Path to)
void rename(Path from, string to)
void rename(string from, string to)

Just like std.file.rename, but optionally takes Path, and obeys scriptlikeEcho and scriptlikeDryRun.

rmdir
void rmdir(Path pathname)
void rmdir(string pathname)

Just like std.file.rmdir, but optionally takes a Path, and obeys scriptlikeEcho and scriptlikeDryRun.

rmdirRecurse
void rmdirRecurse(Path pathname)
void rmdirRecurse(string pathname)

Just like std.file.rmdirRecurse, but optionally takes a Path, and obeys scriptlikeEcho and scriptlikeDryRun.

setTimes
void setTimes(Path name, SysTime accessTime, SysTime modificationTime)
void setTimes(string name, SysTime accessTime, SysTime modificationTime)

Just like std.file.setTimes, but optionally takes a Path, and obeys scriptlikeEcho and scriptlikeDryRun.

symlink
void symlink(Path original, Path link)
void symlink(string original, Path link)
void symlink(Path original, string link)
void symlink(string original, string link)

Posix-only. Just like std.file.symlink, but optionally takes Path, and obeys scriptlikeEcho and scriptlikeDryRun.

symlink
void symlink(Path original, Path link)
Undocumented in source. Be warned that the author may not have intended to support it.
symlink
void symlink(string original, Path link)
Undocumented in source. Be warned that the author may not have intended to support it.
symlink
void symlink(Path original, string link)
Undocumented in source. Be warned that the author may not have intended to support it.
symlink
void symlink(string original, string link)
Undocumented in source. Be warned that the author may not have intended to support it.
tempDir
Path tempDir()

Just like std.file.tempDir, but returns a Path.

thisExePath
Path thisExePath()

Just like std.file.thisExePath, but returns a Path.

timeLastModified
SysTime timeLastModified(Path name)

Just like std.file.timeLastModified, but takes a Path.

timeLastModified
SysTime timeLastModified(Path name, SysTime returnIfMissing)

Just like std.file.timeLastModified, but takes a Path.

tryCopy
bool tryCopy(T1 from, T2 to)

If 'from' exists, then copy. Otherwise do nothing. Obeys scriptlikeEcho and scriptlikeDryRun.

tryMkdir
bool tryMkdir(T name)

If 'name' doesn't already exist, then mkdir. Otherwise do nothing. Obeys scriptlikeEcho and scriptlikeDryRun.

tryMkdirRecurse
bool tryMkdirRecurse(T name)

If 'name' doesn't already exist, then mkdirRecurse. Otherwise do nothing. Obeys scriptlikeEcho and scriptlikeDryRun.

tryRemove
bool tryRemove(T name)

If 'name' exists, then remove. Otherwise do nothing. Obeys scriptlikeEcho and scriptlikeDryRun.

tryRename
bool tryRename(T1 from, T2 to)

If 'from' exists, then rename. Otherwise do nothing. Obeys scriptlikeEcho and scriptlikeDryRun.

tryRmdir
bool tryRmdir(T name)

If 'name' exists, then rmdir. Otherwise do nothing. Obeys scriptlikeEcho and scriptlikeDryRun.

tryRmdirRecurse
bool tryRmdirRecurse(T name)

If 'name' exists, then rmdirRecurse. Otherwise do nothing. Obeys scriptlikeEcho and scriptlikeDryRun.

trySymlink
bool trySymlink(T1 original, T2 link)

Posix-only. If 'original' exists, then symlink. Otherwise do nothing. Obeys scriptlikeEcho and scriptlikeDryRun.

trySymlink
bool trySymlink(T1 original, T2 link)
Undocumented in source. Be warned that the author may not have intended to support it.
write
void write(Path name, void[] buffer)
void write(string name, void[] buffer)

Just like std.file.write, but optionally takes a Path, and obeys scriptlikeEcho and scriptlikeDryRun.

Imports

FileException (from std.file)
public import std.file : FileException, SpanMode, attrIsDir, attrIsFile, attrIsSymlink;
Undocumented in source.
SpanMode (from std.file)
public import std.file : FileException, SpanMode, attrIsDir, attrIsFile, attrIsSymlink;
Undocumented in source.
attrIsDir (from std.file)
public import std.file : FileException, SpanMode, attrIsDir, attrIsFile, attrIsSymlink;
Undocumented in source.
attrIsFile (from std.file)
public import std.file : FileException, SpanMode, attrIsDir, attrIsFile, attrIsSymlink;
Undocumented in source.
attrIsSymlink (from std.file)
public import std.file : FileException, SpanMode, attrIsDir, attrIsFile, attrIsSymlink;
Undocumented in source.

Properties

isDir
bool isDir [@property getter]

Just like std.file.isDir, but takes a Path.

isFile
bool isFile [@property getter]

Just like std.file.isFile, but takes a Path.

isSymlink
bool isSymlink [@property getter]

Just like std.file.isSymlink, but takes a Path.

Templates

slurp
template slurp(Types...)

Just like std.file.slurp, but takes a Path.

Variables

scriptlikeCustomEcho
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.

scriptlikeDryRun
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.

scriptlikeEcho
bool scriptlikeEcho;

If true, all commands will be echoed. By default, they will be echoed to stdout, but you can override this with scriptlikeCustomEcho.

Meta

License

zlib/libpng

Authors

Nick Sabalausky