Commit Graph

16 Commits

Author SHA1 Message Date
Jarek Kobus
398b5656b4 Utils: Use multi-arg for strings
Change-Id: I57d87b8f0435c7b304c484ad4d728b59780f212d
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2023-01-11 11:03:23 +00:00
Marcus Tillmanns
aee7afd50b ProjectExplorer: Improve error reporting
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>
2023-01-10 07:12:39 +00:00
Kai Köhne
56baf8c058 Remove GPL-3.0+ from license identifiers
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>
2023-01-06 11:15:13 +00:00
hjk
ca6b14cf01 ProjectExplorer: Funnel environment fetching through device access
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>
2022-12-15 14:17:36 +00:00
Marcus Tillmanns
eca7044361 Utils: Add std::expected implementation
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>
2022-12-14 10:39:29 +00:00
Jarek Kobus
36be7b8375 Utils: Don't call mutable expressions inside QTC_ASSERT
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>
2022-12-09 08:10:17 +00:00
hjk
3537c9974e Utils: Use .path() instead of .toString() in some local cases
Same effect, but "better" conceptionally.

Change-Id: Ic33bdc097b38176e81413736b2eb44d1fb7d0a3f
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-11-29 10:10:27 +00:00
hjk
a146403596 Utils: Make FilePath::refersToExe(...) return the found item
... and use in on the CMake side.

Change-Id: Ib215ebc4f87beb67b6a302d0c42e7b955a2fa5b7
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2022-11-28 11:30:38 +00:00
hjk
a333efe901 Utils: Introduce a FilePath::refersToExecutableFile
... to avoid the need in user code to care for .exe and .bat suffixes.

Change-Id: Ic249f14273f72c663912482555f98be1af923823
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-11-22 07:15:54 +00:00
hjk
f59ca97a84 Utils: Sanitize FilePath::onDevice()
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>
2022-11-17 10:13:05 +00:00
Marcus Tillmanns
4cab804e85 Utils: Don't return self during find
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>
2022-10-19 08:23:10 +00:00
Marcus Tillmanns
508dd23de4 Utils: Use Linux quoting in UnixDeviceFileAccess
This forces all commands in UnixDeviceFileAccess to
use Unix style quoting of commands.

Change-Id: Ia8a2691b7058789a7afa95a9bb87f155a36cf680
Reviewed-by: David Schulz <david.schulz@qt.io>
2022-10-18 12:16:56 +00:00
Marcus Tillmanns
a1e960a27c Utils: Fix iterateWithFind
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>
2022-10-14 12:52:03 +00:00
hjk
296538d23d Utils: Add FilePath::isSymLink
Needed to fix GenericUploadStep handle the device->device case.

Change-Id: I551ac0957879e5b8737c22fa823d8b2e6bec0b5e
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2022-10-14 08:29:08 +00:00
Marcus Tillmanns
a22d62e57d Utils: Add FilePath::isSameFile()
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>
2022-10-13 11:25:48 +00:00
hjk
1fa3255242 Utils: Split off file access interface from IDevice
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>
2022-10-13 10:38:35 +00:00