Whether something exists at path: a file, a directory or anything else the system can examine. A link is followed,
so a link whose target is missing does not count. false also for an empty path or one with a NUL byte.
file_exists :: (path: string) -> bool
Parameters
- path: string
Returns
- bool
#import "Extensions/Environment";
#import "File";
base := environment_variable("TMPDIR");
if base == "" base = environment_variable("TEMP");
if base == "" base = "/tmp";
path := tprint("%/jai-doc-exists.txt", base);
defer file_delete(path);
assert(!file_exists(path));
assert(write_entire_file(path, "x"));
assert(file_exists(path));