Class FileSystemBase
Platform implementation of filesystem service.
Inheritance
Assembly: FlaxEngine.dll
File: Engine/Platform/Base/FileSystemBase.h
Syntax
public class FileSystemBase
Methods
AreFilePathsEqual(const StringView& path1, const StringView& path2)
Declaration
public static bool AreFilePathsEqual(const StringView& path1, const StringView& path2)
Parameters
|
StringView
path1
|
|
StringView
path2
|
Returns
|
bool
|
ConvertAbsolutePathToRelative(const String& basePath, const String& path)
Converts absolute path into relative path to basePath.
Declaration
public static String ConvertAbsolutePathToRelative(const String& basePath, const String& path)
Parameters
|
String
basePath
Base path |
|
String
path
Absolute path |
Returns
|
String
Relative path |
ConvertAbsolutePathToRelative(const String& path)
Converts absolute path into relative path to engine startup folder.
Declaration
public static String ConvertAbsolutePathToRelative(const String& path)
Parameters
|
String
path
Absolute path |
Returns
|
String
Relative path |
ConvertRelativePathToAbsolute(const String& basePath, const String& path)
Converts path relative to basePath into absolute path.
Declaration
public static String ConvertRelativePathToAbsolute(const String& basePath, const String& path)
Parameters
|
String
basePath
Base path |
|
String
path
Path relative to basePath |
Returns
|
String
Absolute path |
ConvertRelativePathToAbsolute(const String& path)
Converts path relative to the engine startup folder into absolute path.
Declaration
public static String ConvertRelativePathToAbsolute(const String& path)
Parameters
|
String
path
Path relative to the engine directory |
Returns
|
String
Absolute path |
CopyFile(const StringView& dst, const StringView& src)
Copies the file.
Declaration
public static bool CopyFile(const StringView& dst, const StringView& src)
Parameters
|
StringView
dst
Destination path. |
|
StringView
src
Source file path. |
Returns
|
bool
True if failed, otherwise false. |
DeleteFile(const StringView& path)
Deletes an existing file.
Declaration
public static bool DeleteFile(const StringView& path)=delete
Parameters
|
StringView
path
File path |
Returns
|
bool
True if operation failed, otherwise false. |
FileExists(const StringView& path)
Checks if a given file exists.
Declaration
public static bool FileExists(const StringView& path)=delete
Parameters
|
StringView
path
File path to check. |
Returns
|
bool
True if file exists, otherwise false. |
GetExtension(const StringView& path)
Retrieves file extension (without a dot).
Declaration
public static String GetExtension(const StringView& path)
Parameters
|
StringView
path
Input path to process |
Returns
|
String
File extension |
GetFileLastEditTime(const StringView& path)
Gets last time when file has been modified (in UTC).
Declaration
public static DateTime GetFileLastEditTime(const StringView& path)=delete
Parameters
|
StringView
path
The file path to check. |
Returns
|
DateTime
The last write time or DateTime::MinValue() if cannot get data. |
GetFileSize(const StringView& path)
Gets the size of the file (in bytes).
Declaration
public static uint64 GetFileSize(const StringView& path)=delete
Parameters
|
StringView
path
File path |
Returns
|
uint64
Amount of bytes in file, or 0 if failed. |
GetSpecialFolderPath(const SpecialFolder type, String& result)
Gets the special folder path.
Declaration
public static void GetSpecialFolderPath(const SpecialFolder type, String& result)=delete
Parameters
|
SpecialFolder
type
The folder type. |
|
String
result
The result full path. |
GetTempFilePath(String& tmpPath)
Gets the file path to the temporary file that can be created and used.
Declaration
public static void GetTempFilePath(String& tmpPath)
Parameters
|
String
tmpPath
The temporary path. |
IsReadOnly(const StringView& path)
Checks if file is read-only.
Declaration
public static bool IsReadOnly(const StringView& path)=delete
Parameters
|
StringView
path
File path. |
Returns
|
bool
True if file is read-only, otherwise false. Returns false if failed or path is invalid. |
IsRelative(const StringView& path)
Checks if path type is relative.
Declaration
public static bool IsRelative(const StringView& path)
Parameters
|
StringView
path
Input path to check |
Returns
|
bool
True if input path is relative one, otherwise false |
MoveFile(const StringView& dst, const StringView& src, bool overwrite=false)
Moves the file.
Declaration
public static bool MoveFile(const StringView& dst, const StringView& src, bool overwrite=false)=delete
Parameters
|
StringView
dst
Destination path. |
|
StringView
src
Source file path. |
|
bool
overwrite
True if allow overriding destination file if it already exists, otherwise action will fail. |
Returns
|
bool
True if failed, otherwise false. |
NormalizePath(String& path)
Normalizes input path for valid path name for current platform file system.
Declaration
public static void NormalizePath(String& path)
Parameters
|
String
path
Path to normalize |
SaveBitmapToFile(byte* data, uint32 width, uint32 height, uint32 bitsPerPixel, const uint32 padding, const String& path)
Declaration
public static void SaveBitmapToFile(byte* data, uint32 width, uint32 height, uint32 bitsPerPixel, const uint32 padding, const String& path)
Parameters
|
byte
data
|
|
uint32
width
|
|
uint32
height
|
|
uint32
bitsPerPixel
|
|
uint32
padding
|
|
String
path
|
SetReadOnly(const StringView& path, bool isReadOnly)
Sets file read-only flag.
Declaration
public static bool SetReadOnly(const StringView& path, bool isReadOnly)=delete
Parameters
|
StringView
path
File path. |
|
bool
isReadOnly
Read-only flag value to set. |
Returns
|
bool
True if operation failed, otherwise false. |
ShowBrowseFolderDialog(Window* parentWindow, const StringView& initialDirectory, const StringView& title, String& path)
Displays a standard dialog box that prompts the user to select a folder.
Declaration
public static bool ShowBrowseFolderDialog(Window* parentWindow, const StringView& initialDirectory, const StringView& title, String& path)
Parameters
|
Window
parentWindow
The parent window. |
|
StringView
initialDirectory
The initial directory. |
|
StringView
title
The dialog title. |
|
String
path
The output path. |
Returns
|
bool
True if failed, otherwise false. |
ShowFileExplorer(const StringView& path)
Opens a standard file explorer application and navigates to the given directory.
Declaration
public static bool ShowFileExplorer(const StringView& path)
Parameters
|
StringView
path
The path. |
Returns
|
bool
True if failed, otherwise false. |
ShowOpenFileDialog(Window* parentWindow, const StringView& initialDirectory, const StringView& filter, bool multiSelect, const StringView& title, Array<String, HeapAllocation>& filenames)
Displays a standard dialog box that prompts the user to open a file(s).
Example file filters: "All Files\0." "All Files\0.\0Image Files\0.png;.jpg"
Declaration
public static bool ShowOpenFileDialog(Window* parentWindow, const StringView& initialDirectory, const StringView& filter, bool multiSelect, const StringView& title, Array<String, HeapAllocation>& filenames)
Parameters
|
Window
parentWindow
The parent window or null. |
|
StringView
initialDirectory
The initial directory. |
|
StringView
filter
The file filter string as null-terminated pairs of name and list of extensions. Multiple file extensions must be separated with semicolon. |
|
bool
multiSelect
True if allow multiple files to be selected, otherwise use single-file mode. |
|
StringView
title
The dialog title. |
|
Array<String, HeapAllocation>
filenames
The output names of the files picked by the user. |
Returns
|
bool
True if failed, otherwise false. |
ShowSaveFileDialog(Window* parentWindow, const StringView& initialDirectory, const StringView& filter, bool multiSelect, const StringView& title, Array<String, HeapAllocation>& filenames)
Displays a standard dialog box that prompts the user to save a file(s).
Example file filters: "All Files\0." "All Files\0.\0Image Files\0.png;.jpg"
Declaration
public static bool ShowSaveFileDialog(Window* parentWindow, const StringView& initialDirectory, const StringView& filter, bool multiSelect, const StringView& title, Array<String, HeapAllocation>& filenames)
Parameters
|
Window
parentWindow
The parent window. |
|
StringView
initialDirectory
The initial directory. |
|
StringView
filter
The file filter string as null-terminated pairs of name and list of extensions. Multiple file extensions must be separated with semicolon. |
|
bool
multiSelect
True if allow multiple files to be selected, otherwise use single-file mode. |
|
StringView
title
The title. |
|
Array<String, HeapAllocation>
filenames
The output names of the files picked by the user. |
Returns
|
bool
True if failed, otherwise false. |