delfile

Overview of the delfile function.

Function definition
function delfile(path: string): ()

Errors:

  • Illegal Path

    • The path provided is considered 'unsafe'.

  • failed to delete file with error: "..."

    • Occurs when the file cannot be deleted.

    • ... will be the error message provided by the standard C++ filesystem library.

Remarks

If the provided file does not exist at path, then the function does nothing.

High-Level Overview:

Deletes the file present at path.

Low-Level Overview:

pathis read from the luau heap, then utilising std::filesystem::is_regular_file we validate if the provided path (once sanitised) is pointing to a valid file in the filesystem; if so, it is deleted utilizing std::filesystem::remove

Last updated