Commit Graph

191 Commits

Author SHA1 Message Date
Eike Ziller
e7ddd8a5b7 FilePath: Return optional bytearray from device hooks
For differentiating between "error" and "empty file".

Change-Id: I1806bb7386f5e7db28489f9f7e685648bfc20110
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: hjk <hjk@qt.io>
2022-09-15 11:28:18 +00:00
Marcus Tillmanns
2f0a26c1f5 Filepath: Revert "root"
Change-Id: I3f8e8d8eb32f4e3246942aad2f1205034bfafc07
Reviewed-by: hjk <hjk@qt.io>
2022-09-13 07:58:04 +00:00
Eike Ziller
2c51e4bc17 FilePath: Return optional bytearray for file contents
For differentiating between "error" and "empty file".

Change-Id: I2c019ceac625e7be3180afa4d47ae3a24df91c1d
Reviewed-by: hjk <hjk@qt.io>
2022-09-12 11:57:04 +00:00
Christian Kandeler
8e9e457daa Utils: Make FilePath::canonicalPath() work for directories
... in the Windows implementation.
Amends 1073f89886.

Change-Id: Id264e9844634fc8d2afae5b2a7a2355882136315
Reviewed-by: David Schulz <david.schulz@qt.io>
2022-09-07 07:35:42 +00:00
hjk
ba2956984c Utils: Add a private FilePath::encodedHost() helper
Change-Id: I7ce1c7e1e892b3a14f9d31e106b58e8340d574d8
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-09-06 11:09:40 +00:00
Eike Ziller
b1fd3f6e33 Fix build of sdktool
QStringView::first was introduced in Qt 6.0, use QStringView::left
instead

Amends a8145ff6c9

Change-Id: I6983eb0f35cc6f4887160f1d201a43db0fee361b
Reviewed-by: hjk <hjk@qt.io>
2022-09-06 09:33:54 +00:00
Christian Kandeler
1073f89886 Utils: Try harder in FilePath::canonicalPath()
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>
2022-09-06 08:15:11 +00:00
hjk
a8145ff6c9 Utils: Replace FilePath::m_root member by a int m_rootLen
... and keep the string data as part of m_path.

Change-Id: Iaa43183906b59a419ddd78ed0102fe48c686bbb4
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-09-05 10:15:15 +00:00
hjk
56a8c59845 Utils: Make OsType addition less visible
Change-Id: I092930ef6b0ed6876e32ed6b0c78d6bd58becddc
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-09-02 08:25:27 +00:00
hjk
7cfc3d26bc Utils: Replace FilePath part setters
... by a combined version. This will make it easier to store the parts
in one QString object.

Change-Id: Ie85a77e3957c78a30e49998fe2e617af35a8ad17
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-09-01 07:59:29 +00:00
Eike Ziller
04e50438eb Utils: Remove Utils::optional
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>
2022-09-01 06:58:04 +00:00
Marcus Tillmanns
1af0eb3504 FilePath: Fix setFromString for short urls
FilePath::setFromString failed previously for URLs
without a path, e.g. "http://qt.io" as it would add
the scheme and host to its path.

Also added a test for various URLs

Change-Id: I6c22489c0af7154734390aa1e5e12693864210b1
Reviewed-by: hjk <hjk@qt.io>
2022-09-01 06:19:01 +00:00
Lucie Gérard
a7956df3ca Use SPDX license identifiers
Replace the current license disclaimer in files by
a SPDX-License-Identifier.

Task-number: QTBUG-67283
Change-Id: I708fd1f9f2b73d60f57cc3568646929117825813
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2022-08-26 12:27:18 +00:00
hjk
11648298c8 Utils: Port some FilePath part accessors to QStringView
Change-Id: Ib5cc262e44c73880b6538eed714365e3d685870a
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-08-22 13:27:56 +00:00
Eike Ziller
60f2945f08 FilePath: Remove unused include
Change-Id: I0ad971a65d25bcecf19c2094225f7f95f9121385
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2022-08-22 08:16:37 +00:00
Marcus Tillmanns
4f0ac5678f FilePath: Fix operator+ to use stringAppend instead of pathAppended
Change-Id: I643a2e9eed22fafc793bbc75cba0344c4005b3f3
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
2022-08-16 11:35:12 +00:00
Marcus Tillmanns
50bedd5544 FilePath: Fix UNC root/path parsing
* Fixed UNC path parsing to correctly split between root and path
* Fixed tst_fileutils to correspond to windows path handling.

Change-Id: I2849738696a39e8282068ab164514f806f2c5fcf
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: hjk <hjk@qt.io>
2022-08-11 13:54:14 +00:00
Marcus Tillmanns
cd919e6f61 FilePath: Fix for operator+(QString)
Change-Id: I3b9889c8b2cdc8a9d1bf94c3e7a8627e2ff2ac35
Reviewed-by: hjk <hjk@qt.io>
2022-08-11 09:31:26 +00:00
Marcus Tillmanns
aeb33310cb FilePath: Fix parsing of qrc paths
Change-Id: I50d404bafb8d1cb4f0663cd424e1034ae26bb903
Reviewed-by: hjk <hjk@qt.io>
2022-08-11 07:57:51 +00:00
Marcus Tillmanns
e1b0b47efc filepath: Adds m_root to store root part of path
Change-Id: I9e32a2806e9ecd231886749357404b4bf94bef10
Reviewed-by: hjk <hjk@qt.io>
2022-08-04 11:34:34 +00:00
Marcus Tillmanns
04205d1225 FileUtils: Adds toFilePathList function
Change-Id: Ie3137751135fdb6c3161cc886f307323fcce6b72
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-08-04 11:33:53 +00:00
hjk
8945b3832c Utils: Make DeviceFileHooks access a bit more self-contained
Change-Id: Ib13035820021e9eda0585f98885bef9cbd2317a6
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2022-08-04 09:43:04 +00:00
Marcus Tillmanns
451d02c88d FilePath: Remove ::toDir() and deprecation hints
Change-Id: Ib561c019e3fd44cd85504ad4286eb3759ce19516
Reviewed-by: hjk <hjk@qt.io>
2022-08-04 08:46:06 +00:00
Marcus Tillmanns
783f0e1205 filepath: Move FileUtils:: function out of FilePath.cpp
Change-Id: If78c349b0145b86a76cd033e4dbc30b237ad917b
Reviewed-by: hjk <hjk@qt.io>
2022-08-04 08:01:59 +00:00
Marcus Tillmanns
c0b3cc1bbc FilePath: Fix setFromString root for partial path
Change-Id: I3a9352a364c71a8463736b25086a0493ae5c5d31
Reviewed-by: hjk <hjk@qt.io>
2022-08-03 07:09:55 +00:00
Marcus Tillmanns
b2f0f78bdc filepath: Fix windows driver letter handling in fromString()
Change-Id: Ic66e468ed2161bc10136ab31dc29a7358e6d7397
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: hjk <hjk@qt.io>
2022-08-02 13:59:29 +00:00
hjk
87e156fc41 Utils: FilePath::setFromString microoptimizations
Mostly relevant for debug builds.

Change-Id: I3d3789d5ef535afbb87339a75bed076cd548dda3
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2022-08-02 06:20:30 +00:00
Eike Ziller
347e489d14 Merge remote-tracking branch 'origin/8.0'
Conflicts:
	src/plugins/clangcodemodel/clangdclient.cpp
	src/plugins/projectexplorer/kitmanagerconfigwidget.cpp

Change-Id: Id1454bfe8e4f283f3b06ac6945aced2975814161
2022-07-28 11:53:13 +02:00
hjk
2f7b86dab3 Utils: Explain FilePath uses a bit
Change-Id: Ia7589c7e2b8440547dcc3db9251c37cd01eeced3
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2022-07-26 11:42:38 +00:00
Alessandro Portale
afe0b5a42d Utils: Use FilePaths alias instead of QList<FilePath>
Change-Id: I2eb0956377e46a34e73208b301eb662704a25e8b
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-07-21 16:05:38 +00:00
Marcus Tillmanns
3462bc67be filesystem: Add QFSEngine for filepaths
Change-Id: Ibd0c88c69863c0877138d8cc45541530c359bd9c
Reviewed-by: hjk <hjk@qt.io>
2022-07-21 13:14:01 +00:00
hjk
775aa8f9e5 Utils: Fix doCleanPath()
QString::right() != QString::mid(), except for very special cases.

Change-Id: I0b4d8e46b7631975dd1c3c38b50f4f336bff3f2e
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2022-07-14 13:24:49 +00:00
hjk
802de0eb5e Utils: Collapse most of porting,h
Taking the Qt 6 branches, leaving some dummies until downstream
adapted.

Change-Id: Ib9b86568d73c341c8f740ba497c3cbfab830d8a1
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-07-13 09:44:09 +00:00
hjk
df26d12b73 Utils: Add a convenience function to iterate over multiple directories
Change-Id: I7959b65b5502362b15fab3c0fd78b3e76431ff64
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-07-04 08:00:51 +00:00
hjk
0c10e54f68 Utils: Introduce a doCleanPath() helper function
Respecting :// separators, which QDir::cleanPath() breaks.

Note that this still uses the host-dependent QDir::cleanPath
in the implementation.

Change-Id: Icd6c41ee52b5a0c4ff7398863cb26811a61261ec
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-06-27 07:37:45 +00:00
hjk
73e072c7bb Git: Modernize executable search
Change-Id: I3bc1293aab74fcff5574d9a339a52776c891b6cf
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2022-06-22 08:37:45 +00:00
hjk
9341733b37 Utils: Document escaping rules for % and / in FilePath
Change-Id: Ief9e739e167f724b1626c3478ac4d6f94fc3bac0
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-06-22 06:33:09 +00:00
hjk
bf8bf1adc0 Utils: Also use device name when trying to disambiguate path displays
With two /tmp/foo.cpp from different devices there is no directly
visible difference in the Open Documents. Adding the device path
for remote cases introduces a difference.

For local files there is no visible difference.

Change-Id: I6f1632d6f51ff24573831af3161492989c5c0bec
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2022-06-14 13:50:54 +00:00
hjk
8b6aeb9d16 Utils: Use case folding instead of toUpper for hashing file paths
Change-Id: I680db342b6b0b2433951064bb236ef7efadabf3f
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2022-06-10 11:02:41 +00:00
hjk
31f0ba4ef9 Utils: Introduce FilePath::displayName()
To produce "<filepath> on <devicename>" which is nicer to read than
"<scheme>://<deviceid>/<filepath>" in some places.

Change-Id: Ife47bbf49382cf73dd4709d826bdeaa8730f88be
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2022-06-02 15:14:27 +00:00
Jarek Kobus
2853660a59 Utils: More forward declarations / drop unused headers [D-G]
Round 1 - focus on headers.
For classes with initial in range [D-G].
Try to keep the same separators between different kind of headers.

Change-Id: Id42cd7b3743a816f75cecb6b576c0e37cb057473
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: hjk <hjk@qt.io>
2022-05-25 07:13:52 +00:00
Jarek Kobus
0a8dbaf153 Utils lib: Remove unneeded includes from cpp files
It's a result of a team work consisting of yellow triangle and me.

Change-Id: I8b4812766da70e0785ae71bf0cb71357379e2514
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2022-05-19 12:37:20 +00:00
hjk
4ca780ccb3 Utils: Use simplistic percentencoding for host parts of FilePath
Host parts with true slashes (as possible currently for docker ids
using the repo:tag style) breaks parsing in FilePath::fromString.

This provides a means to use such names nevertheless.

Task-number: QTCREATORBUG-26856
Change-Id: Iba3568c5708fe495d0dd657540f30a2519e7f45f
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-02-25 15:33:47 +00:00
Alessandro Portale
a386725c6c Utils: Support sorting by QDir::Time in FilePath::dirEntries
Amends: f9c97d23c7

Task-number: QTCREATORBUG-26939
Change-Id: I9122d51af102547086687b1b9c6cb1553b609673
Reviewed-by: hjk <hjk@qt.io>
(cherry picked from commit ec0513bf4b)
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2022-01-27 09:22:06 +00:00
hjk
1fc83d2a56 Utils: Wrap various file system iteration flags and filters
... into a single class.

This makes passing them around as a whole easier, and opens a path
to have "generic" filters in form of a lambda or such.

Change-Id: Ibf644b2fedcf0f1a35258030710afff8f5873f88
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2022-01-26 13:13:41 +00:00
hjk
f9c97d23c7 Utils: Add optional recursion for file system iteration
Change-Id: Icded897b129aebd7132376cff55717e16dffc040
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2022-01-18 11:52:29 +00:00
Jarek Kobus
35cde5ddae Introduce IDevice::bytesAvailable()
It's going to replace RemoteLinuxCheckForFreeDiskSpaceService.

Change-Id: If8c30a57b9013387c69412f12102bcd4d41a88b5
Reviewed-by: hjk <hjk@qt.io>
2022-01-05 14:33:50 +00:00
hjk
7677dc4ba0 Utils: Use callbacks when iterating remote file systems
This will make recursion easier and has the potential to avoid creating
big intermediate lists.

Change-Id: I44d42925dae9c0048338c7d0a6aa26606f314c28
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2021-12-17 06:57:46 +00:00
hjk
3fd1122759 Utils: Rename FilePath::deviceLocalPath() to nativePath()
Change-Id: Id2b2b7d54a536d569c6dc717365ee28421e2b56b
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-11-12 09:02:45 +00:00
hjk
652b9844e6 Utils: FilePathify Environment::{ap,pre}pendOrSetPath etc
Change-Id: Idfa5ec247337570936b0236cab9d3a5669792ca0
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-11-10 07:26:31 +00:00