Quirrel4.41.0

system.remove

Defined in module "system"
from "system" import remove
remove(path: string)

Deletes the file at the given path, throws error in case of fail

Parameters

pathstringpath of the file to delete

Errors

Throws remove() failed if the underlying C remove() call fails, for example because the file does not exist or is in use. The message carries no further detail: no path, no errno, no reason.

Notes

Unlike getenv, setenv and system, remove is built the same way on every target; there is no platform stub.

No example runs here because deleting a file changes the machine, which every example on this site must avoid. Typical use:

from "system" import remove

try {
  remove("scratch.tmp")
} catch (e) {
  println(e) // "remove() failed"
}

See also

renameRenames the file from old to new path, throws error in case of fail
systemmodule index