| kind | = | "FileSystem" |
Gives access to things related to the file system.
- [](+globTexts)
- copyFile(fileName, destination)
- createDirectory!(directoryName, createPath false)
- directory?(directoryName)
- ensureDirectory(dir)
- exists?(entryName)
- file?(fileName)
- parentOf(entryName)
- readFully(fileName)
- readLines(filename)
- removeDirectory!(directoryName)
- removeFile!(fileName)
- withOpenFile(fileName, code)
Tries to interpret the given arguments as strings describing file globs, and returns an array containing the result of applying these globs.
Copies a file. Takes two text arguments, where the first is the name of the file to copy and the second is the name of the destination. If the destination is a directory, the file will be copied with the same name, and if it's a filename, the file will get a new name
Takes one string argument and creates a directory with that name. It also takes an optional second argument. If it's true, will try to create all necessary directories inbetween. Default is false. Will signal a condition if the directory already exists, or if there's a file with that name.
Takes one string argument and returns true if it's the relative or absolute name of a directory, and false otherwise.
takes one argument that is the relative or absolute path to something that should be a directory. if it exists but isn't a directory, a condition will be signalled. if it exists, and is a directory, nothing is done, and if it doesn't exist it will be created.
[ show source ]
method(dir,
if(exists?(dir),
if(file?(dir),
bind(restart(ignore, fn),
error!(Condition Error IO, text: "Can't create directory #{dir}, since it already exists and is a file"))),
createDirectory!(dir, true)
)
)
Takes one string argument and returns true if it's the relative or absolute name of something that exists.
Takes one string argument and returns true if it's the relative or absolute name of a file, and false otherwise.
Takes one string argument that should be the path of a file or directory, and returns the parent of it - or nil if there is no parent.
Takes one string argument that should be a file name, and returns a text of the contents of this file.
reads the full content of a file and returns a list containing each line of the file as a separate element of the list.
[ show source ]
method(filename,
if(System windows?,
readFully(filename) split("\r\n"),
readFully(filename) split("\n"))
)
Takes one string argument and removes a directory with that name. Will signal a condition if the directory doesn't exist, or if there's a file with that name.
Takes one string argument and removes a file with that name. Will signal a condition if the file doesn't exist, or if there's a directory with that name.