|
swift
|
Utility class for file operations. More...
#include <fileutils.h>
Static Public Member Functions | |
| static const QString & | jsonAppendix () |
| Our JSON file name appendix. | |
| static const QString & | jsonWildcardAppendix () |
| JSON wildcard + appendix. | |
| static bool | writeStringToFile (const QString &content, const QString &fileNameAndPath) |
| Write string to text file. | |
| static bool | writeStringToLockedFile (const QString &content, const QString &fileNameAndPath) |
| Write string to file, with a lock so two applications can't access at the same time. | |
| static QString | readFileToString (const QString &fileNameAndPath) |
| Read file into string. | |
| static QString | readLockedFileToString (const QString &fileNameAndPath) |
| Read file into string, with a lock so two applications can't access at the same time. | |
| static QString | readFileToString (const QString &filePath, const QString &fileName) |
| Read file into string. | |
| static QString | readLockedFileToString (const QString &filePath, const QString &fileName) |
| Read file into string, with a lock so two applications can't access at the same time. | |
| static bool | writeByteArrayToFile (const QByteArray &data, const QString &fileNameAndPath) |
| Write byte array to file. | |
| static QString | appendFilePaths (const QString &path1, const QString &path2) |
| Append file paths. | |
| static QString | appendFilePathsAndFixUnc (const QString &path1, const QString &path2) |
| Append file paths. | |
| static QString | appendFilePaths (const QString &path1, const QString &path2, const QString &path3) |
| Append file paths. | |
| static QString | appendFilePathsAndFixUnc (const QString &path1, const QString &path2, const QString &path3) |
| Append file paths. | |
| static QString | pathUp (const QString &path) |
| One path up. | |
| static QString | stripFileFromPath (const QString &path) |
| Strip file from path a/b/c.json a/b, return path. | |
| static QString | stripFirstSlashPart (const QString &path) |
| Strip first slash part "/a/b" => "a/b", "h:/foo" => foo. | |
| static QStringList | stripFirstSlashParts (const QStringList &paths) |
| Strip first slash part "/a/b" => "a/b", "h:/foo" => foo. | |
| static QString | stripLeadingSlashOrDriveLetter (const QString &path) |
| Strip leading slash or drive letter "/a/b" => "a/b" "H:/Foo" => "Foo". | |
| static QStringList | stripLeadingSlashOrDriveLetters (const QStringList &paths) |
| Strip first slash part "/a/b" => "a/b", "h:/foo" => foo. | |
| static QString | lastPathSegment (const QString &path) |
| Last path segment a/b/c => c. | |
| static QString | normalizeFilePathToQtStandard (const QString &filePath) |
| Normalize file path to Qt standard, e.g by turning \ to /. | |
| static QStringList | makeDirectoriesRelative (const QStringList &directories, const QString &rootDirectory, Qt::CaseSensitivity cs=osFileNameCaseSensitivity()) |
| Make directory paths relative to root directory. | |
| static bool | sameDirectories (const QStringList &dirs1, const QStringList &dirs2, Qt::CaseSensitivity cs=osFileNameCaseSensitivity()) |
| Same directories, order in list does not matter and lists are cleaned up. | |
| static Qt::CaseSensitivity | osFileNameCaseSensitivity () |
| Case sensitivity for current OS. | |
| static bool | isFileNameCaseSensitive () |
| Case sensitive file names. | |
| static bool | matchesExcludeDirectory (const QString &directoryPath, const QString &excludePattern, Qt::CaseSensitivity cs=osFileNameCaseSensitivity()) |
| Is directory path matching the exclude path? | |
| static bool | isExcludedDirectory (const QDir &directory, const QStringList &excludeDirectories, Qt::CaseSensitivity cs=osFileNameCaseSensitivity()) |
| Directory to be excluded? | |
| static bool | isExcludedDirectory (const QFileInfo &fileInfo, const QStringList &excludeDirectories, Qt::CaseSensitivity cs=osFileNameCaseSensitivity()) |
| Directory to be excluded? | |
| static bool | isExcludedDirectory (const QString &directoryPath, const QStringList &excludeDirectories, Qt::CaseSensitivity cs=osFileNameCaseSensitivity()) |
| Directory to be excluded? | |
| static QStringList | removeSubDirectories (const QStringList &directories, Qt::CaseSensitivity cs=osFileNameCaseSensitivity()) |
| Removes sub directories in list: A/B A/B/C B B/D -> A/B B returned. | |
| static QString | findFirstExisting (const QStringList &filesOrDirectory) |
| Find first existing file or directory (means exists on file system). | |
| static QString | findFirstFile (const QDir &dir, bool recursive, const QStringList &nameFilters={}, const QStringList &excludeDirectories={}, std::function< bool(const QFileInfo &)> predicate={}) |
| Returns path to first file in dir which matches the optional wildcard and predicate, or empty string. | |
| static bool | containsFile (const QDir &dir, bool recursive, const QStringList &nameFilters={}, const QStringList &excludeDirectories={}, std::function< bool(const QFileInfo &)> predicate={}) |
| True if there exists a file in dir which matches the optional wildcard and predicate. | |
| static QString | findFirstNewerThan (const QDateTime &time, const QDir &dir, bool recursive, const QStringList &nameFilters={}, const QStringList &excludeDirectories={}) |
| Returns path to first file in dir newer than the given time, optionally matching a wildcard, or empty string. | |
| static bool | containsFileNewerThan (const QDateTime &time, const QDir &dir, bool recursive, const QStringList &nameFilters={}, const QStringList &excludeDirectories={}) |
| True if there exists a file in dir newer than the given time, optionally matching a wildcard. | |
| static QFileInfoList | enumerateFiles (const QDir &dir, bool recursive, const QStringList &nameFilters={}, const QStringList &excludeDirectories={}, std::function< bool(const QFileInfo &)> predicate={}) |
| Returns list of all files in dir, optionally matching a wildcard and predicate. | |
| static QFileInfo | findLastModified (const QDir &dir, bool recursive, const QStringList &nameFilters={}, const QStringList &excludeDirectories={}) |
| Returns path to the last modifed file in dir, optionally matching a wildcard, or empty string. | |
| static QFileInfo | findLastCreated (const QDir &dir, bool recursive, const QStringList &nameFilters={}, const QStringList &excludeDirectories={}) |
| Returns path to the last created file in dir, optionally matching a wildcard, or empty string. | |
| static const QStringList & | getSwiftExecutables () |
| Get all swift executables. | |
| static QStringList | getBaseNamesOnly (const QStringList &fileNames) |
| Turn paths and filenames in base names only. | |
| static QStringList | getFileNamesOnly (const QStringList &fileNames) |
| Turn paths and filenames in file names only. | |
| static QString | lockFileError (const QLockFile &lockFile) |
| Error message explaining why a QLockFile failed to lock. | |
| static QString | fixWindowsUncPath (const QString &filePath) |
| UNC file paths on Qt start with "/", but UNC file paths only work when they start with "//". | |
| static QStringList | fixWindowsUncPaths (const QStringList &filePaths) |
| Fix UNC file paths. | |
| static bool | isWindowsUncPath (const QString &filePath) |
| Windows UNC path? | |
| static QString | windowsUncMachine (const QString &filePath) |
| Machine in Windows UNC path. | |
| static QSet< QString > | windowsUncMachines (const QSet< QString > &paths) |
| All UNC machines from the paths. | |
| static QString | toWindowsLocalPath (const QString &path) |
| To Windows path using "\" delimiter. | |
| static QString | humanReadableFileSize (qint64 size) |
| Human readable (GB, MB, ..) file size. | |
| static const QStringList & | executableSuffixes () |
| Executable file name appendixes. | |
| static bool | isExecutableFile (const QString &fileName) |
| Executable file (decided by appendix). | |
| static bool | isSwiftInstaller (const QString &fileName) |
| swift installer | |
Utility class for file operations.
Definition at line 28 of file fileutils.h.
|
static |
Append file paths.
Definition at line 116 of file fileutils.cpp.
|
static |
Append file paths.
Definition at line 216 of file fileutils.cpp.
|
static |
Append file paths.
Definition at line 138 of file fileutils.cpp.
|
static |
Append file paths.
Definition at line 221 of file fileutils.cpp.
|
static |
True if there exists a file in dir which matches the optional wildcard and predicate.
Definition at line 441 of file fileutils.cpp.
|
static |
True if there exists a file in dir newer than the given time, optionally matching a wildcard.
Definition at line 455 of file fileutils.cpp.
|
static |
Returns list of all files in dir, optionally matching a wildcard and predicate.
Definition at line 461 of file fileutils.cpp.
|
static |
Executable file name appendixes.
Definition at line 702 of file fileutils.cpp.
|
static |
Find first existing file or directory (means exists on file system).
Definition at line 376 of file fileutils.cpp.
|
static |
Returns path to first file in dir which matches the optional wildcard and predicate, or empty string.
Definition at line 398 of file fileutils.cpp.
|
static |
Returns path to first file in dir newer than the given time, optionally matching a wildcard, or empty string.
Definition at line 448 of file fileutils.cpp.
|
static |
Returns path to the last created file in dir, optionally matching a wildcard, or empty string.
Definition at line 507 of file fileutils.cpp.
|
static |
Returns path to the last modifed file in dir, optionally matching a wildcard, or empty string.
Definition at line 489 of file fileutils.cpp.
UNC file paths on Qt start with "/", but UNC file paths only work when they start with "//".
Definition at line 573 of file fileutils.cpp.
|
static |
Fix UNC file paths.
Definition at line 591 of file fileutils.cpp.
|
static |
Turn paths and filenames in base names only.
Definition at line 532 of file fileutils.cpp.
|
static |
Turn paths and filenames in file names only.
Definition at line 543 of file fileutils.cpp.
|
static |
Get all swift executables.
Definition at line 525 of file fileutils.cpp.
|
static |
Human readable (GB, MB, ..) file size.
Definition at line 681 of file fileutils.cpp.
|
static |
Directory to be excluded?
Definition at line 313 of file fileutils.cpp.
|
static |
Directory to be excluded?
Definition at line 324 of file fileutils.cpp.
|
static |
Directory to be excluded?
Definition at line 334 of file fileutils.cpp.
|
static |
Executable file (decided by appendix).
Definition at line 711 of file fileutils.cpp.
|
static |
Case sensitive file names.
Definition at line 300 of file fileutils.cpp.
|
static |
swift installer
Definition at line 723 of file fileutils.cpp.
|
static |
Windows UNC path?
Definition at line 607 of file fileutils.cpp.
|
static |
Our JSON file name appendix.
Definition at line 28 of file fileutils.cpp.
|
static |
JSON wildcard + appendix.
Definition at line 34 of file fileutils.cpp.
Last path segment a/b/c => c.
Definition at line 199 of file fileutils.cpp.
Error message explaining why a QLockFile failed to lock.
Definition at line 554 of file fileutils.cpp.
|
static |
Make directory paths relative to root directory.
Definition at line 250 of file fileutils.cpp.
|
static |
Is directory path matching the exclude path?
Definition at line 302 of file fileutils.cpp.
Normalize file path to Qt standard, e.g by turning \ to /.
Definition at line 239 of file fileutils.cpp.
|
static |
Case sensitivity for current OS.
Definition at line 295 of file fileutils.cpp.
One path up.
Definition at line 229 of file fileutils.cpp.
Read file into string.
Definition at line 83 of file fileutils.cpp.
|
static |
Read file into string.
Definition at line 106 of file fileutils.cpp.
Read file into string, with a lock so two applications can't access at the same time.
Definition at line 96 of file fileutils.cpp.
|
static |
Read file into string, with a lock so two applications can't access at the same time.
Definition at line 111 of file fileutils.cpp.
|
static |
Removes sub directories in list: A/B A/B/C B B/D -> A/B B returned.
Definition at line 345 of file fileutils.cpp.
|
static |
Same directories, order in list does not matter and lists are cleaned up.
Definition at line 275 of file fileutils.cpp.
Strip file from path a/b/c.json a/b, return path.
Definition at line 144 of file fileutils.cpp.
Strip first slash part "/a/b" => "a/b", "h:/foo" => foo.
Definition at line 157 of file fileutils.cpp.
|
static |
Strip first slash part "/a/b" => "a/b", "h:/foo" => foo.
Definition at line 172 of file fileutils.cpp.
Strip leading slash or drive letter "/a/b" => "a/b" "H:/Foo" => "Foo".
Definition at line 182 of file fileutils.cpp.
|
static |
Strip first slash part "/a/b" => "a/b", "h:/foo" => foo.
Definition at line 189 of file fileutils.cpp.
To Windows path using "\" delimiter.
Definition at line 675 of file fileutils.cpp.
Machine in Windows UNC path.
Definition at line 623 of file fileutils.cpp.
All UNC machines from the paths.
Definition at line 644 of file fileutils.cpp.
|
static |
Write byte array to file.
Definition at line 57 of file fileutils.cpp.
|
static |
Write string to text file.
Definition at line 40 of file fileutils.cpp.
|
static |
Write string to file, with a lock so two applications can't access at the same time.
Definition at line 73 of file fileutils.cpp.