The FileUtils class provides some static methods to execute file operations.
More...
#include <fileutils.h>
The FileUtils class provides some static methods to execute file operations.
- Author
- ubruhin
- Date
- 2016-08-07
QByteArray readFile |
( |
const FilePath & |
filepath | ) |
|
|
static |
Read the content of a file into a QByteArray.
- Parameters
-
- Returns
- The content of the file
- Exceptions
-
void writeFile |
( |
const FilePath & |
filepath, |
|
|
const QByteArray & |
content |
|
) |
| |
|
static |
Write the content of a QByteArray into a file.
If the file does not exist, it will be created (with all parent directories).
- Parameters
-
filepath | The file to (over)write |
content | The content to write |
- Exceptions
-
Copy a single file.
- Parameters
-
source | Filepath to an existing file. |
dest | Filepath to a non-existing file (if it exists already, an exception will be thrown). |
- Exceptions
-
Copy a directory recursively.
- Parameters
-
source | Filepath to an existing directory. |
dest | Filepath to a non-existing directory (if it exists already, an exception will be thrown). |
- Exceptions
-
Move/rename a file or directory.
- Parameters
-
source | Filepath to an existing file or directory. |
dest | Filepath to a non-existing file/directory (if it exists already, an exception will be thrown). |
- Exceptions
-
void removeFile |
( |
const FilePath & |
file | ) |
|
|
static |
Remove a single file.
- Parameters
-
file | Filepath to a file (may or may not exist). |
- Exceptions
-
void removeDirRecursively |
( |
const FilePath & |
dir | ) |
|
|
static |
Remove a directory recursively.
- Parameters
-
dir | Filepath to a directory (may or may not exist). |
- Exceptions
-
Create a directory with all parent directories.
- Parameters
-
path | Filepath to a directory (may or may not exist). |
QList< FilePath > getFilesInDirectory |
( |
const FilePath & |
dir, |
|
|
const QStringList & |
filters = QStringList() |
|
) |
| |
|
static |
Get all files in a given directory (optionally filtered by extension)
- Parameters
-
dir | Filepath to a directory (must exist) |
filter | Only files matching this filter are returned |
- Returns
- A list of filepaths to files in the specified directory
The documentation for this class was generated from the following files:
- /home/travis/build/LibrePCB/LibrePCB/libs/librepcb/common/fileio/fileutils.h
- /home/travis/build/LibrePCB/LibrePCB/libs/librepcb/common/fileio/fileutils.cpp