|
| cFile (const AString &iFileName, eMode iMode) |
| Constructs and opens / creates the file specified, use IsOpen() to check for success. More...
|
|
| cFile (void) |
| Simple constructor - creates an unopened file object, use Open() to open / create a real file. More...
|
|
void | Close (void) |
|
void | Flush () |
| Flushes all the bufferef output into the file (only when writing) More...
|
|
long | GetSize (void) const |
| Returns the size of file, in bytes, or -1 for failure; asserts if not open. More...
|
|
bool | IsEOF (void) const |
|
bool | IsOpen (void) const |
|
bool | Open (const AString &iFileName, eMode iMode) |
|
std::basic_string< std::byte > | Read (size_t a_NumBytes) |
| Reads up to a_NumBytes bytes, returns the bytes actually read, or empty string on failure; asserts if not open. More...
|
|
int | Read (void *a_Buffer, size_t a_NumBytes) |
| Reads up to a_NumBytes bytes into a_Buffer, returns the number of bytes actually read, or -1 on failure; asserts if not open. More...
|
|
int | ReadRestOfFile (AString &a_Contents) |
| Reads the file from current position till EOF into an AString; returns the number of bytes read or -1 for error. More...
|
|
long | Seek (int iPosition) |
| Seeks to iPosition bytes from file start, returns old position or -1 for failure; asserts if not open. More...
|
|
long | Tell (void) const |
| Returns the current position (bytes from file start) or -1 for failure; asserts if not open. More...
|
|
int | Write (const void *a_Buffer, size_t a_NumBytes) |
| Writes up to a_NumBytes bytes from a_Buffer, returns the number of bytes actually written, or -1 on failure; asserts if not open. More...
|
|
int | Write (std::string_view a_String) |
|
| ~cFile () |
| Auto-closes the file, if open. More...
|
|
|
static AString | ChangeFileExt (const AString &a_FileName, const AString &a_NewExt) |
| Returns a_FileName with its extension changed to a_NewExt. More...
|
|
static bool | Copy (const AString &a_SrcFileName, const AString &a_DstFileName) |
| Copies a file, returns true if successful. More...
|
|
static bool | CreateFolder (const AString &a_FolderPath) |
| Creates a new folder with the specified name. More...
|
|
static bool | CreateFolderRecursive (const AString &a_FolderPath) |
| Creates a new folder with the specified name, creating its parents if needed. More...
|
|
static bool | Delete (const AString &a_Path) |
| Deletes a file or a folder, returns true if successful. More...
|
|
static bool | DeleteFile (const AString &a_FileName) |
| Deletes a file, returns true if successful. More...
|
|
static bool | DeleteFolder (const AString &a_FolderName) |
| Deletes a folder, returns true if successful. More...
|
|
static bool | DeleteFolderContents (const AString &a_FolderName) |
| Deletes all content from the specified folder. More...
|
|
static bool | Exists (const AString &a_FileName) |
| Returns true if the file specified exists. More...
|
|
static AString | GetExecutableExt () |
| Returns the customary executable extension used by the current platform. More...
|
|
static AStringVector | GetFolderContents (const AString &a_Folder) |
| Returns the list of all items in the specified folder (files, folders, nix pipes, whatever's there). More...
|
|
static unsigned | GetLastModificationTime (const AString &a_FileName) |
| Returns the last modification time (in current timezone) of the specified file. More...
|
|
static AString | GetPathSeparator () |
| Returns the path separator used by the current platform. More...
|
|
static long | GetSize (const AString &a_FileName) |
| Returns the size of the file, or a negative number on error. More...
|
|
static bool | IsFile (const AString &a_Path) |
| Returns true if the specified path is a regular file. More...
|
|
static bool | IsFolder (const AString &a_Path) |
| Returns true if the specified path is a folder. More...
|
|
static char | PathSeparator () |
|
static AString | ReadWholeFile (const AString &a_FileName) |
| Returns the entire contents of the specified file as a string. More...
|
|
static bool | Rename (const AString &a_OrigPath, const AString &a_NewPath) |
| Renames a file or folder, returns true if successful. More...
|
|
Definition at line 37 of file File.h.
bool cFile::CreateFolderRecursive |
( |
const AString & |
a_FolderPath | ) |
|
|
static |
Creates a new folder with the specified name, creating its parents if needed.
Path may be relative or absolute. Returns true if the folder exists at the end of the operation (either created, or already existed). Supports only paths that use the path separator used by the current platform (MSVC CRT supports slashes for file paths, too, but this function doesn't)
Definition at line 467 of file File.cpp.
unsigned cFile::GetLastModificationTime |
( |
const AString & |
a_FileName | ) |
|
|
static |
Returns the last modification time (in current timezone) of the specified file.
The value returned is in the same units as the value returned by time() function. If the file is not found / accessible, zero is returned. Works for folders, too, when specified without the trailing path separator.
Definition at line 645 of file File.cpp.