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>
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>
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>
This is alternative to setStd[Out/Err](Line)Callback()
methods. In this way there may be many clients connected
to textOnStandard[Output/Error]() signals. This should
also simplify handling the lifetime of user callback.
Change-Id: If82baa1f3f9c432ed431926619b9bbf11d770a84
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: hjk <hjk@qt.io>
Pass on stderr data and exit code to the caller, it's typically
in a better condition to handle errors.
Use it to notify the user about non-available 'find' arguments
and fix the fallback to ls-based operation.
Change-Id: I535535de2ffa09cad1dd6e9b07eb69f807dbae2f
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
Reviewed-by: hjk <hjk@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>
We've been requiring C++17 since Qt 6.0, and our qAsConst use finally
starts to bother us (QTBUG-99313), so time to port away from it
now.
Since qAsConst has exactly the same semantics as std::as_const (down
to rvalue treatment, constexpr'ness and noexcept'ness), there's really
nothing more to it than a global search-and-replace.
Task-number: QTBUG-99313
Change-Id: I88edd91395849574436299b8badda21bb93bea39
Reviewed-by: hjk <hjk@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>
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>
It's too late, and apparently "close-without-open" is triggered:
QDEBUG: tst_fsengine::testRootPathContainsFakeDir() SOFT ASSERT: "m_tempStorage" in /data/dev/creator/src/libs/utils/fsengine/fsengine_impl.cpp:64
QDEBUG: tst_fsengine::testListDir() SOFT ASSERT: "m_tempStorage" in /data/dev/creator/src/libs/utils/fsengine/fsengine_impl.cpp:64
Change-Id: Ic7100d7abddfffca909b412ea7ea19e295c86729
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
We apply not very often the parent to views. So it can lead to dangling
pointer if the parent is used by other objects and does not handle the
null pointer case. It can lead to double deletion if the parent is
deleted before the object when it is on the stack or handled by smart
pointer.
If you really want to use it there is still setParent.
Change-Id: I1fc6b145a50f037a0e9d415fb36e7970ea7296ed
Reviewed-by: Tim Jenssen <tim.jenssen@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>
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>
Don't hardcode a single type of OS (Windows/Non-Windows) via
QDir::rootPath(), actually check both, independent of the host OS.
Most of the new tests are actually failing, as the parsing code uses
the host OS. Mark those tests as "Expexted fail" for now.
Change-Id: Ic907582ad3959ef95b9618826d987d4eab463b49
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Recent changes in FilePath made it incompatible with windows targets
(by design). Therefore we disable the tests here.
Change-Id: I2182c64f36268f5ab6282d149930653a79cc9aa1
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
DeviceShell does not support piping commands at the moment.
To continue to support ::bytesAvailable the parsing of the
output from "df" is moved to FileUtils::bytesAvailableFromDFOutput.
Change-Id: Ia229208748aa6c572b99899e6ae042bdd5654f4a
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Origanally my idea was that there can be no invalid model nodes created.
Because it was practically to return invalid nodes we added a default
constructor. So now we have invalid nodes because we explicitly created
them and invalid nodes because we destroyed them(except the root node
which has to be always valid). To remove all the isValid test two new
approches are introduced.
Instead of throwing an exception a reasonable return value is provided
or the function is simply doing nothing.
For example if you try to remove an non existing property nothing is
happen. If you try to get an non existing property you get an invalid
property. If you then try to get an value from that property you get an
null(false) value.
All object can now be tested for true or false. So you can write:
if (auto property = getnode().property("foo"))
// do something with if node and property are positive
Task-number: QDS-7454
Change-Id: I9ebb0bae45354cedc0b6cfe610d1a71435ee1f38
Reviewed-by: Aleksei German <aleksei.german@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
This saves about 2 seconds out of 5 seconds spent in
displayResult() for converting from QString into
FilePath in main thread (use case: gitgrep with
2 million hits).
Change-Id: I6334e8559986501c34c90a5c7c6b4acc9a6953e0
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: hjk <hjk@qt.io>