Skip to content

File IO

Nenkai edited this page Jul 13, 2024 · 7 revisions

File IO

Warning

This API was introduced after GT4.

Check file exists

if (pdistd::ReadFile(path))
{
    // File exists
}

Reading Files

var st = main::pdistd::ReadFile(path);
if (st["result"] == pdistd::FileError::OK)
{
    var buf = st["buffer"];
    // Do something with the buffer...
}

Get File Info

var st = pdistd::GetFileStatus(path);
st["result"] // Result
st["size"] // File Size
st["_time"] // Datetime

Copying/Removing Files/Directories

pdistd::CopyFile(source, destination);
pdistd::RemoveFile(file);
pdistd::RemoveDirectory(directory, true); // second argument is recursive.
Clone this wiki locally