After the change to a single-string representation, the QString
construction for path() is expensive for the comparison operators
and simple convienience functions.
Change-Id: I643c7115d3ad52f971d1692230b6eab82645b810
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Some creeped into settings earlier, making the paths that were
meant to be empty look non-empty.
Also add a test for FilePath::isEmpty().
Change-Id: I99e3dd673294206558f9fee9b7c7874d2441327e
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Previously FilePath::fromString did not decode %25 (%) and %2f (/),
so a round of ::fromString(::toString()) would not return the same host.
Change-Id: I99c7317fb149443c2e52c099f7da7c4ef6768aff
Reviewed-by: hjk <hjk@qt.io>
Hopefully less confusion about the direction.
Change-Id: I61727d6c4d19e0dfe46f24ff24f5d90f9835d05c
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Previously isChildOf would only look at the path.
But if the two paths are from different devices
it would mistakenly return true if the paths were
similar.
Change-Id: Icdb1aebe61167183ec85fa56ae0708681a59a9f8
Reviewed-by: hjk <hjk@qt.io>
FilePath::isSameFile() checks if two files are the same file.
It first checks if its on the same device. If it is, it will
try to read the fileId of the files and compare them.
Change-Id: I83668955cacd4e5ed03d43a3fee2be29e9d0a6f0
Reviewed-by: hjk <hjk@qt.io>
The file accessing functions form now a class hierarchy by themselves,
the devices return a suitable point.
The previous implementation was mildly confusing by the special handling
of the DesktopDevice, fallbacks and remote cases in the same function
leading to unnecessary boilerplate when adding new functions and
codepaths that sometimes passed the FilePath API twice.
Implemented are a "DesktopDeviceFileAccess" taking care of the
previous !needsDevice() branches and a "UnixDeviceFileAccess"
covering the current docker and RL uses.
As a side-effect this unifies to a large degree the current docker
and RL code paths with were occasionally deviating from each other
while they shouldn't.
Change-Id: I4ff59d4be2a07d13e2ca5e9ace26a84160a87c9d
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
To speed up file dialogs we introduce a 1 minute cache for
the FilePathInfo.
A new version of "IDevice::iterateDirectories" allows implementations to
provide the FilePathInfo directly.
DockerDevice implements fetching the filePathInfo during
iterateDirectories which greatly improves the speed again.
Change-Id: I24ac16adb2478cbf16a22012e72fcb8910dcdac5
Reviewed-by: hjk <hjk@qt.io>
Use QFile::seek to implement locally and a dd seek based poor man's
implementation on RL and docker.
Change-Id: I241d1c34c00e991845d132ad8edefa1377ba1311
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Implicitly fixing methods like absoluteFilePath too.
Fixes e.g. JSON wizards that are registered from a plugin QRC file, like
McuSupport wizards (run with McuSupport plugin enabled and create a
"Application (Qt for MCU)" application).
Change-Id: I296ba1c5eb63c9eb27f9a55e65019125faf546ea
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Re-usable in a variety of unix-based devices.
Change-Id: I480ad9b128336059752b99dc1f1ae3b4899a4077
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Plus a few integers to get access to the pieces.
This reduces sizeof(FilePath) from 72 to 32.
Change-Id: I65eb856ad47b6a250c705d8d01893781a21d8e02
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: hjk <hjk@qt.io>
FilePath::absoluteFilePath() would consider an empty path to be
relative, and resolved it wrt the current working directory. That is
unexpected in the sense that QFileInfo::absoluteFilePath behaves
differently, and lead to a crash down the line when e.g. a diff editor
was opened when the current working directory is '/' (the default on
macOS when started with "open" or from Finder, Dock or Spotlight).
Make FilePath::absoluteFilePath() return and empty path if the input was
empty.
Change-Id: Ie0d4da50afa24134bd56505b2f4abcf382eee982
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: hjk <hjk@qt.io>
Combination of bf8bf1adc0 and d83f9d71cc broke
the resulting string.
Fixes tst_fileutils file name tests.
Change-Id: I69c485e52bbf76093b903b407ab2ff2f58d28a0d
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Unfortunately, QDir::cleanPath() only cleans according to the rules
of the host system, which can be wrong in remote setups.
As the implementation is not accessible/tweakable from the outside,
copy the relevant code and remove the platform #ifdef's.
Change-Id: Ife9a925412a12d3cef21ed3721a387c61c152ddf
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Intended as helpers for parentDir() to stop when cutting components.
Change-Id: I7615803743351a733d6f3cc9813e9de85973dc61
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
"Fixes" one Q_SKIP and makes the implementation OS-agnostic.
FilePath::osType() actually depends on the host system for not fully
qualified file paths, and that doesn't seem to be the right thing to do
in all cases. The caller may actually have more context to decide
whether this is needed (e.g. in pathchooser.cpp in the context of
"return value from a GUI element, i.e. 'host' implied).
Change-Id: Iff80c17094d2deec79d34d0527223fbcf8294935
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
ensureReachable checks whether the device (if any) of the filepath
can "reach" another FilePath. Devices can then either return false
if they don't, or take action to ensure that the path can be reached.
Change-Id: Ic1a315b9e7d9e37ee649989313a4cdb195a7e4d9
Reviewed-by: hjk <hjk@qt.io>
Changing the toString() to prepend system-specific prefixes
to cater for the remote filesystem model handling had unintended
sideeffects.
This here is the first step to split both paths.
Change-Id: I66cdd9a87802408e2ba95c2e29b9d7cce7fe2553
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
... in the Windows implementation.
Amends 1073f89886.
Change-Id: Id264e9844634fc8d2afae5b2a7a2355882136315
Reviewed-by: David Schulz <david.schulz@qt.io>
On Windows, we now also resolve SUBST drives and NTFS alias mounts.
Task-number: QTCREATORBUG-27869
Task-number: QTCREATORBUG-28031
Change-Id: Ia6b16787e8a691118d56579c0825bb20b066f9b8
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: David Schulz <david.schulz@qt.io>
... and keep the string data as part of m_path.
Change-Id: Iaa43183906b59a419ddd78ed0102fe48c686bbb4
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Since we are now requiring macOS 10.14 we can remove our local
implementation of optional and use std::optional for macOS too.
Change-Id: I2bd018261b68da64f7f031a812045dd7784697e1
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Marco Bubke <marco.bubke@qt.io>