Utils: FsEngine micro-optimizations

Mostly for shorter code, but also save a few cycles due to less
string construction and run time dispatch.

Also, make testFilePathFromToString() test two paths instead one path
twice.

Change-Id: I50a3145bca1a4b262a15e96173ea7ebd9cb678ad
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
hjk
2022-11-29 10:28:37 +01:00
parent f7d022009b
commit 8249eabbad
7 changed files with 46 additions and 63 deletions

View File

@@ -223,15 +223,10 @@ public:
[[nodiscard]] static FilePath fromFileInfo(const QFileInfo &info);
// Support for FSEngine. Do not use unless needed.
enum class SpecialPathComponent {
RootName,
RootPath,
DeviceRootName,
DeviceRootPath,
};
[[nodiscard]] static QString specialPath(SpecialPathComponent component);
[[nodiscard]] static FilePath specialFilePath(SpecialPathComponent component);
[[nodiscard]] static const QString &specialRootName();
[[nodiscard]] static const QString &specialRootPath();
[[nodiscard]] static const QString &specialDeviceRootName();
[[nodiscard]] static const QString &specialDeviceRootPath();
[[nodiscard]] bool ensureReachable(const FilePath &other) const;