findUsingLs did try to enter "." and "..", with especially "." leading
to an endless loop.
findUsingLs also did not correctly concatenate the parent folder
for sub directories.
Change-Id: Ieafad4d4ef38d2fb550ddef1d2edf8183ce8032e
Reviewed-by: hjk <hjk@qt.io>
The number for the plural must be given as the 3rd argument
to the tr() call, not as an arg().
Amends 1359e9c84f
Change-Id: I45241a6acd82041c320bbe476cd2b4cc92247ef3
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Previously ensureWritableDirectory would return true even if the
directory existed but was not writable. This patch fixes that.
Change-Id: I3c97ecb22eae7d77bf1d44b13b22d81ba2529062
Reviewed-by: hjk <hjk@qt.io>
Our atomic write involves writing a temp file and renaming that (which is
the only way to achieve something atomic). This creates a new inode, and
disconnects any hardlinks.
Note that the existing implementation for file paths with needsDevice
already keeps hardlinks intact, because even though it first writes into
a local temporary file it then writes the content directly into the
target with dd.
Check the number of hard links via system API and fallback to unsafe
writing if there are any, for desktop paths.
Fixes: QTCREATORBUG-19651
Change-Id: I3ce1ee81f339f241f0a2c9aa6f2259cb118ebef6
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Basically a.onDevice(b) == b.withNewMappedPath(a), matching the order
of b.withNewPath(a).
Whether the (curretly docker-specific) path mapping is useful /there/, and
whether some of the calls are needed at all is dubious. I added some
FIXME and changed a few cases directly.
Change-Id: I7514736ce922f632f1f737bc496f6783389a42b6
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
"stat" on macOS has slightly different formatting options.
Also adds unittests for UnixDeviceFileAccess
Task-number: QTCREATORBUG-28142
Change-Id: Ib42fc1c22ef2771365e915df34f2286e2c705568
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>
Some versions of dd don't support the status= option.
(e.g. the dd version in boot2qt)
Change-Id: I22aa6571b223b7707e962bd2df9abdd11b438d69
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: hjk <hjk@qt.io>
When trying to open a FileDialog all roots were tested for existence.
This is slow and might show ask-pass.
Since "/" can be considered always valid, we create a fake entry for it
and only test existence of remote paths if they are not a root path.
In the future FilePath should get a "isRoot()" function so we don't just
test for == "/".
Remove the fileAccess from WebAssembly devices.
Change-Id: I7a1a6e7d2025e9fd4428e4bd1d07cdbdb5680c8e
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Previously FileUtils::copyRecursively did create the target folder,
FilePath::copyRecursively now does the same.
If either src or target are .qrc paths, select the fallback copy
routine, as tar cannot read or write to a .qrc folder
see: 7cb74e325f for report about
failing test in testProject_multipleBuildConfigs
Change-Id: I52bb9ad8f018f359f598e5bc8b18ab31c901496f
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Previously anytime a FilePath operation tried to access a device that
does not have a DeviceFileAccess an error message would be thrown.
This patch makes it possible to differentiate between the device not
being found, and the device just not having a DeviceFileAccess
interface.
Also the error message in DeviceFileAccess::exists() was removed as
its not an error to ask if something exists even if it does not.
Change-Id: Ib8c2e08132159d0d97bcd049b59436eb17bdbacd
Reviewed-by: hjk <hjk@qt.io>
Since we also license under GPL-3.0 WITH Qt-GPL-exception-1.0,
this applies only to a hypothetical newer version of GPL, that doesn't
exist yet. If such a version emerges, we can still decide to relicense...
While at it, replace (deprecated) GPL-3.0 with more explicit GPL-3.0-only
Change was done by running
find . -type f -exec perl -pi -e "s/LicenseRef-Qt-Commercial OR GPL-3.0\+ OR GPL-3.0 WITH Qt-GPL-exception-1.0/LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0/g" {} \;
Change-Id: I5097e6ce8d10233993ee30d7e25120e2659eb10b
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Easier nowadays. It's synchronous now, so conceptually worse,
but 'env' is not worse than 'ls', and this is used regularly
all over the place also for larger data sets without being a problem.
Change-Id: I2c2b1db8c07ff5c128700d4a1deefd710967568a
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Adds a std::expected implementation that is compatible with >= C++11.
FilePath::fileContents and FilePath::writeFileContents as well as
FilePath::copyFile are changed to return std::expected.
A couple of macros have been added to aid in using the expected types.
An auto test was added showing how to use the library.
Change-Id: Ibe3aecfc1029a0cf13b45bf5184ff03a04a2393b
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
In order to conform to the theory: "Removing all
QTC_ASSERTs and QTC_CHECKs should not change anything".
Change-Id: I6f5c4486afb422301562d79c662fdde026e4d788
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: hjk <hjk@qt.io>
It's one entry in the FilePath world, so it should start with a QString.
Change-Id: Ib2693f52d56103a4c37ba7361b191c2a5c2a72f8
Reviewed-by: David Schulz <david.schulz@qt.io>
find can return the directory that is searched in as
one of the results. We need to filter it out.
Change-Id: If2902497e67d3a7a216430e725ec86227a392ccb
Reviewed-by: hjk <hjk@qt.io>
This forces all commands in UnixDeviceFileAccess to
use Unix style quoting of commands.
Change-Id: Ia8a2691b7058789a7afa95a9bb87f155a36cf680
Reviewed-by: David Schulz <david.schulz@qt.io>
The change of runInShell to take QString + QStringList meant
that the caller was no longer able to fine tune the argument
escaping. This lead to "find -exec ... \;" being escaped incorrectly.
Changing back to CommandLine fixes this.
Change-Id: I55b09bd745c09912a2a0b4e43432824a99c0dd4e
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
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>