Commit Graph

106 Commits

Author SHA1 Message Date
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
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
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
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
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
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
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
Jarek Kobus
37a4a066e5 Drop Qt5: Remove remaining includes of porting.h
Change-Id: I58a1ae99f75bab0b8db3cc1f24a1c86e2fcdacb6
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-07-20 14:16:31 +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
73e072c7bb Git: Modernize executable search
Change-Id: I3bc1293aab74fcff5574d9a339a52776c891b6cf
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2022-06-22 08:37:45 +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
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
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
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
hjk
c6bc5583d6 Utils: Don't expose FilePath::mapToGlobalPath anymore
The indirection is triggered via scheme and host. And if it already is in
that form we do not need to add these information.

Change-Id: I13c2bd0864a956c5cdaa5e2e6b324bb7f67c93e3
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-10-28 07:53:37 +00:00
hjk
5d190fcfaa Utils: Make FilePath::mapToDevicePath() private
User code is supposed to use .onDevice(...).

Change-Id: Ia14198bbd472db05f5177f06f832dfc468415ba1
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-10-28 05:23:57 +00:00
Orgad Shaneh
3871e40f43 Fix qHash-related size compatibility warnings by MSVC
Change-Id: I3b7981ce78b67db4b996f99682284a0b911d8cd7
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2021-10-20 15:03:51 +00:00
Eike Ziller
0e5d632e5b Move FilePath's hash methods to the right header
Change-Id: Ie3932daf381bc03f37ae67722dcddc5b2e4823e5
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-10-20 07:53:52 +00:00
hjk
34b42a4772 Utils: Introduce FilePath::mapTo{Device,Global}Path
Re-directing via IDevice::mapTo{Device,Global}Path

Change-Id: Ica957839479967790bbd93e90eced66aa0b122a8
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-10-12 11:24:29 +00:00
Artem Sokolovskii
905325358a FilePath: Add bool to lambda iterateDirectory
Change-Id: I017426a48981da2fbeb32b6d5bee87865d583c0b
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2021-09-17 11:37:24 +00:00
Artem Sokolovskii
464f665735 FilePath: Add const to iterateDirectory
Change-Id: I49c1366ca16ca295d0f54a17740a501a6d7a9442
Reviewed-by: hjk <hjk@qt.io>
2021-09-15 11:41:07 +00:00
Artem Sokolovskii
d543ab0fbd FilePath: Add function which iterates through the directory
Change-Id: Iaebd2b08341781307b98b6aae61b0b44b127ce18
Reviewed-by: hjk <hjk@qt.io>
2021-09-15 10:51:45 +00:00
hjk
64324db662 Utils: Remove FilePath::isChildOf(QDir) overload
After replacing its use in the two remaining places.

Change-Id: I6900ccdaf4ba4cf035e59b1222f06b037e7da512
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-09-14 07:22:08 +00:00
hjk
64f439fdaf Utils: Sprinkle [[nodiscard]] across FilePath API
Change-Id: I896a08df417acd113c0953edb78edd364da5265e
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2021-09-13 13:57:13 +00:00
David Schulz
f12409fbd6 FilePath: add [[nodiscard]] to FilePath::cleanPath
Change-Id: I546db0a73b21bc6fe76d6439e0df0bef479106b8
Reviewed-by: hjk <hjk@qt.io>
2021-09-09 12:36:02 +00:00
hjk
35095c542f Utils: Re-order FilePath API a bit
Somewhat more logical blocks. Also make clear which functions should
not be used.

Change-Id: Ia2f7b84347601dbd4d51f42c992a71ddcceb1e0b
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-09-09 06:42:29 +00:00
hjk
bdefc13eba Utils: Rename FilePath::absolutePath(FilePath) to resolvePath
There was already a similar function taking a QString.

After that, the remaining no-argument version of absolutePath()
can be deprecated.

Change-Id: I5b9ad8c8b68a5723891b0aa9f5a37e90db0fe09e
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-09-09 05:42:30 +00:00
hjk
ebf0917b9f Utils: Start adding some asynchronous API to FilePath
Especially with the "remote" scenarios synchronous operations cannot
be expected to work reasonably well.

This here starts with adding asynchronous versions to some of the
FilePath member functions, taking additional "Continuation" style.

This is not necessarily the final syntax (sugar like .then(...) comes
to mind...), but is simple enough for now for the few uses we have,
and it is too early to see what will be needed in the end.

Change-Id: Idf4dde1b77d04cafb81b6c024031145bdd91a762
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-09-01 11:21:30 +00:00
hjk
3b75ca96d6 Utils: Remove FilePath::isWritablePath() uses
And fix remaining users.

Change-Id: I41c27908f2e9f1e253d0b51830ba351b29a84ec5
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-08-27 07:05:29 +00:00
hjk
30f171a491 Utils: Rename FilePath::normalizePathName to normalizedPathName
Change-Id: Ib7bcc9968749649f762a396d3861f7b67711e926
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-08-26 07:03:13 +00:00
Artem Sokolovskii
d3ff45ad8b Utils: Use QtcProcess
Change-Id: Ia3cd4706c6b23a17bc4d84d06018ad16a4e3f428
Reviewed-by: hjk <hjk@qt.io>
2021-08-25 13:38:58 +00:00
hjk
57a90b019f Utils: Introduce a FilePath::searchInPath() convenience function
Diverts to searchInDirectory(). Use it in some places.

Change-Id: I9e5642f0ae0ed4dd9fb9f34bcaa11a25bd26c690
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-08-23 11:56:24 +00:00
hjk
db014de91c Utils: Introduce FilePath::normalizePathName()
... as wrapper around FileUtils::normalizePathName, and use it
in some places.

Change-Id: I42792e1f175b8119c8db930eae80a9f822ac70fa
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2021-08-23 10:37:26 +00:00
hjk
285ec1476e TextEditor: Modernize SnippetsCollection
More FilePath use, foreach, less .h exposure.

Change-Id: Ie24324b33333733736f0cd12c7637798fc88aa34
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-08-19 11:05:42 +00:00
hjk
27708158db Utils: Introduce FilePath::setPermission()
And implement it for the direct access docker case.

Change-Id: I5c91402630a5b010fdbcaab96c435f66a36f2e3e
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-08-18 12:25:44 +00:00
hjk
7c28c4f744 Utils: Introduce a FilePath constructor from char arrays
Similar to QT_RESTRICTED_CAST_FROM_ASCII to avoid the need for
decorations in user code.

At the same time, drop some convenience constructors and functions
in CommandLine and Icon essentially serving the same purpose.

Change-Id: Ida4e5ac19c2da0a4298a97b2a8e1511d56bbb79d
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-08-17 05:34:10 +00:00
hjk
a78665ede7 Utils: Rename FilePath::searchOnDevice to searchInDirectories
Makes it a bit clearer that there's no magic path use or similar
beyond this point.

Change-Id: I86c06850d16bf777db05ad23b540d8096926c059
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-08-12 08:29:09 +00:00
hjk
6418eb2dda Utils: Use EnvironmentChange instead of Environment in several places
For path choosers this makes it easier to change the actual base retrospectively
based on the device for the file path entered by the user.

In other cases "end user code" only knows that something needs to
be added to PATH to get a proper environment. This here lets this
code to specify the change alone without bothering about the base
environment this might be applied to.

Change-Id: I726aaa2fd2feb0bee7158f601aac660b0ac6327b
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2021-08-11 13:33:52 +00:00