FileUtils contains functions for platform independent file-handing. More...
#include <Radiant/FileUtils.hpp>
Static Public Member Functions | |
| static QString | baseFilename (const QString &filepath) |
| Extract the base filename. More... | |
| static QString | baseFilenameWithPath (const QString &filepath) |
| Extract the base filename. More... | |
| static FILE * | createFilePath (const QString &filePath) |
| Opens the given file for writing and creates the directories in the path if they don't exist. More... | |
| static QString | directorySeparator () |
| Returns the directory separator for the current platform. More... | |
| static bool | fileAppendable (const QString &filename) |
| Check if the user can append to a given file. More... | |
| static QString | filename (const QString &filepath) |
| Extract filename. More... | |
| static bool | fileReadable (const QString &filename) |
| Check if a given file is readable. More... | |
| static QString | findFile (const QString &filename, const QString &paths) |
| Find a file given a list of paths to search. More... | |
| static QString | findOverWritable (const QString &filename, const QString &paths) |
| Try to find a file that could be over-written. More... | |
| static unsigned long | getFileLen (std::ifstream &file) |
| Get the size of a file. More... | |
| static unsigned long | getFileLen (const QString &filename) |
| Get the size of a file. More... | |
| static void | indent (FILE *f, int levels) |
| Adds indentation space to the given stream. More... | |
| static bool | isWritable (const QString &path) |
| Check if the given file or path is writable. More... | |
| static Radiant::TimeStamp | lastModified (const QString &filePath) |
| Returns seconds from epoch, 0 in case of error. More... | |
| static QByteArray | loadTextFile (const QString &filename) |
| Load a text file. More... | |
| static bool | looksLikeImage (const QString &filePath) |
| Does the given filename look like an image (checks the extension) More... | |
| static bool | looksLikeVideo (const QString &filePath) |
| Does the given filename look like a video (checks the extension) More... | |
| static QString | path (const QString &filepath) |
| Extract path. More... | |
| static QString | pathSeparator () |
| Returns the path separator for the current platform. More... | |
| static bool | removeFile (const char *filename) |
| Remove a file. More... | |
| static bool | renameFile (const char *from, const char *to) |
| Rename a file. More... | |
| static QString | suffix (const QString &filepath) |
| Extract suffix. More... | |
| static QString | suffixLowerCase (const QString &filepath) |
| Extract suffix, and return it in lower-case. More... | |
| static bool | suffixMatch (const QString &filename, const QString &suffix) |
| Check if a suffix matches. More... | |
| static bool | writeTextFile (const char *filename, const char *contents) |
| Writes a string to a text file. More... | |
FileUtils contains functions for platform independent file-handing.
|
static |
Extract the base filename.
| filepath | Full filename with path |
|
static |
Extract the base filename.
| filepath | Full filename with path |
|
static |
Opens the given file for writing and creates the directories in the path if they don't exist.
| filePath | Full filename with path |
|
static |
Returns the directory separator for the current platform.
|
static |
Check if the user can append to a given file.
This function is useful if you want to overwrite a file, and want to check beforehand that it is possible.
| filename | Name of file |
|
static |
Extract filename.
| filepath | Full filename with path |
|
static |
Check if a given file is readable.
| filename | Name of file |
|
static |
Find a file given a list of paths to search.
The directory names are separated by the platform path separator (colon on UNIX, semicolon on Windows) If the file is not found, returns an empty string.
| filename | Name of file |
| paths | Search path |
|
static |
Try to find a file that could be over-written.
If such cannot be found, then return filename.
| filename | Name of file |
| paths | Search path |
|
static |
Get the size of a file.
| file | File to retrieve length of |
|
static |
Get the size of a file.
| filename | Name of file to retrieve length of |
|
static |
Adds indentation space to the given stream.
| f | Handle to a file stream |
| levels | Number of indentation levels to insert This function is typically used when writing object hierarchies for human-readable output. |
|
static |
Check if the given file or path is writable.
| path | path to check |
|
static |
Returns seconds from epoch, 0 in case of error.
| filePath | Full filename with path |
|
static |
Load a text file.
If the reading fails, the returned QByteArray.isNull().
| filename | Name of file |
|
static |
Does the given filename look like an image (checks the extension)
| filePath | Full filename with path |
|
static |
Does the given filename look like a video (checks the extension)
| filePath | Full filename with path |
|
static |
Extract path.
| filepath | Full filename with path |
|
static |
Returns the path separator for the current platform.
|
static |
Remove a file.
| filename | Name of file |
|
static |
Rename a file.
| from | Source filename |
| to | Destination filename |
|
static |
Extract suffix.
| filepath | Full filename with path |
|
static |
Extract suffix, and return it in lower-case.
| filepath | Full filename with path |
|
static |
Check if a suffix matches.
| filename | Name of file |
| suffix | Suffix of file with dot (e.g. ".png") |
|
static |
Writes a string to a text file.
| filename | Name of output file |
| contents | String to write to file |