File System Functions


// File system functions.
class RVAPI FileSys
{
public:
    // Check if file exists at [path].
    static bool IsFile(wcstr path);

    // Check if directory exists at [path].
    static bool IsDir(wcstr path);

    // Check if directory is empty at [path].
    static bool IsDirEmpty(wcstr path);

    // Get file date/time at [path].
    static DateTime GetFileDate(wcstr path);

    // Get directory date/time at [path].
    static DateTime GetDirDate(wcstr path);

    // Get file size at [path].
    static uint GetFileSize(wcstr path);

    // Get directory size at [path].
    static uint GetDirSize(wcstr path);

    // Get temp directory at [path].
    static void GetTempDir(String &path);

    // Get app directory at [path].
    static void GetAppDataDir(String &path);

    // Get documents directory at [path].
    static void GetDocsDir(String &path);

    // Get desktop directory at [path].
    static void GetDesktopDir(String &path);

    // Get absolute path of [path].
    static void GetAbsPath(String &abs, wcstr rel);

    // Set current directory to [path].
    static void GetCurDir(String &path);

    // Get list of files at [path]. [list] must be an array of String items.
    // Filter files by passing wildcards to [filter].
    static void GetFiles(wcstr path, Array<String> &files, wcstr filter = 0);

    // Get list of directories at [path]. [list] must be an array of String items.
    // Filter files by passing wildcards to [filter].
    static void GetDirs(wcstr path, Array<String> &dirs, wcstr filter = 0);

    // Copy file at [from] to location [to]. Ignore error if [noError].
    static void CopyFile(wcstr from, wcstr to, bool noError = false);

    // Delete file at [path]. Ignore error if [noError]
    static void DeleteFile(wcstr path, bool noError = false);

    // Rename file at [oldPath] to location [newPath]. Ignore error if [noError].
    static void RenameFile(wcstr from, wcstr to);

    // Rename directory at [oldPath] to location [newPath]. Ignore error if [noError].
    static void RenameDir(wcstr from, wcstr to);

    // Rename directory at [oldPath] to location [newPath].  Ignore error if [noError].
    static void MoveDir(wcstr from, wcstr to);

    // Create directory at [path].
    static void CreateDir(wcstr path);

    // Delete directory at [path].
    static void DeleteDir(wcstr path);

    // Select directory using Windows OS dialog at [path].
    static void SelectDir(const String &path);

    // Set current directory to app's home directory.
    static void SetCurDir();

    // Set current directory to [path].
    static void SetCurDir(wcstr path);
};