Commit Graph

226 Commits

Author SHA1 Message Date
Marcus Tillmanns
1c5aa22257 Utils: Add PersistentCacheStore
Change-Id: I952e0271afcc0fd4b03ef75fa5acb219be153290
Reviewed-by: hjk <hjk@qt.io>
2023-09-05 12:22:06 +00:00
David Schulz
b418c81414 Utils: collect host root dir once
This improves the startup performance ~30% on certain machines

Change-Id: Ic7b74d42b0e13ec1dd695d4f322de021b996c051
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
2023-08-31 11:29:38 +00:00
David Schulz
be54b3db2f Python: check for pyside in qt installation
Fixes: PYSIDE-2153
Change-Id: I91ec24eb6a71d4f29edaf7a707b3c49a4deb725a
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2023-08-28 06:04:08 +00:00
David Schulz
5122d8addc Merge remote-tracking branch 'origin/11.0'
Change-Id: Idbf5f641aa9db7574cf2a4bd09adb8bcd03da894
2023-08-22 08:10:48 +02:00
Marcus Tillmanns
324e924178 Utils: Fix FilePath::isRootPath()
Change-Id: I287bae74469ba501ecb03d51f04f7aaa5f4a7268
Reviewed-by: hjk <hjk@qt.io>
2023-08-15 10:50:24 +00:00
hjk
3ad1a6ecdd Revert "Utils: Allow (encoded) colons in host parts of FilePath"
This reverts commit f65b343c8a.

It's not needed anymore for the problem it was supposed to help with
(bad docker imange/qmake paths written by sdktool) and complicates
reasoning in this area.

Change-Id: Idef2ef9147d73e83461589907aa68c09721755cb
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
2023-08-10 10:36:03 +00:00
hjk
0be0772fc9 Merge remote-tracking branch 'origin/11.0'
Change-Id: Ib67c8ecb1865ee31ca6485c9287039ba877c68cd
2023-08-10 10:03:04 +02:00
Marcus Tillmanns
1ca8487e91 Utils: Fix for invalid docker paths from installer
Some installers wrote "docker:/" into the settings instead of
"docker://". This adds a workaround for that.

Fixes: QTCREATORBUG-29474
Change-Id: I49a69d6fa9e4fe383257313e534660814c4a011f
Reviewed-by: hjk <hjk@qt.io>
2023-08-09 09:49:57 +00:00
hjk
f65b343c8a Utils: Allow (encoded) colons in host parts of FilePath
Change-Id: I6acd8ac8ab44cb895cc08ce6b1972802f79a2a53
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
2023-08-08 12:16:32 +00:00
Marcus Tillmanns
7a8c4adf95 Utils: Don't complain about non-existing devices
FilePath::exists() does not need to warn if the device does not exist.

Change-Id: I2ce6a5dec8806a8ee0a2f0e53a2c556c1d8c9e5b
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: hjk <hjk@qt.io>
2023-08-08 06:29:39 +00:00
Jarek Kobus
8dd46d0399 Various Plugins: Simplify return FilePath statements
Change-Id: Ia9efb86f722caca1492b577d51442f1f23b804b4
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2023-08-02 08:19:23 +00:00
Marcus Tillmanns
39837d9c26 Utils: ensureWritableDir returns expected_str
Allows calling code to get better feedback to user.

Change-Id: I6d11787d314921dc052e87a8348683b221a17425
Reviewed-by: hjk <hjk@qt.io>
2023-06-22 08:23:33 +00:00
Orgad Shaneh
1afa720f2c FilePath: Replace Q_OS_WINDOWS with Q_OS_WIN for consistency
Change-Id: Ia624c804e54fe4c5213351078a7aa9c8dec9f262
Reviewed-by: hjk <hjk@qt.io>
2023-06-01 11:45:50 +00:00
Leena Miettinen
e037bd2004 Doc: Fix qdoc warnings in FilePath docs
Also fix some misc style issues, such as missing punctuation.

Change-Id: If5a9243eb9ce57c87096f9f0e184c8a802df54aa
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2023-05-25 11:55:07 +00:00
Orgad Shaneh
861b98a76a FilePath: Remove const ref for enum argument
Change-Id: I86c5466cdcd8f74816456e70463157f28a4e37bc
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
2023-05-24 05:58:48 +00:00
hjk
ae26fa0dd7 Utils: Add a FilePath::searchAllInDirectories
A variation that does not stop on the first found item.
Useful for auto-detection scenarios.

Use "WithAnySuffix" as default to cover .cmd and .bat etc.

Change-Id: I48f36eff06699c046e34c8e2646546bcff20ae8b
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
2023-05-23 12:42:27 +00:00
Leena Miettinen
ce0ab1cd27 Doc: Replace \p with \a and remove \param
The qdoc command for arguments/parameters is \a. It is enough to
place it somewhere in the text to make qdoc happy.

Change-Id: I164fbd63277787a68b0216ad3fbbed768b975d91
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
2023-05-23 09:31:32 +00:00
hjk
c02750428c Utils: Rework FilePath::searchInDirectory
Avoid the detour through Environment::search* by copying and adapting
some code. Long term the Environment::search* functions may go
as FilePath is generally a better entry point into the remote
world nowadays.

Change-Id: I352d6fb68292d76f29a3454a786322bfe081d53d
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
2023-05-23 06:54:44 +00:00
Leena Miettinen
8c288bf05f Doc: Add "\inmodule QtCreator" to \class and \namespace docs
To get rid of QDoc warnings.

Change-Id: Idd39b7ae4327798c376f424c94d6617bcaee2258
Reviewed-by: hjk <hjk@qt.io>
2023-05-22 12:48:35 +00:00
Marcus Tillmanns
69fbe72752 Utils: Use FilePath hash in operator==
Change-Id: Ibbea420a5a5353da221d285b70272cdf9b09d0d0
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2023-05-12 11:47:08 +00:00
Marcus Tillmanns
6149fd8bfa Utils: Cache FilePath::qHash
Calling toCaseFolded is expensive if the same filepath is hashed
often, so we calculate the hash value once and cache the result.

One such case was found to happen when parsing tests,
as the cpp parser is queried a lot and it uses hash maps / sets
with filepaths.

Change-Id: Ic3ca7f09e8f108f5a89b3fdb17743ae7c3258001
Reviewed-by: hjk <hjk@qt.io>
2023-05-12 11:34:18 +00:00
Marcus Tillmanns
fc95d7a737 Utils: Improve FilePath::sort
Remove the conversion to/from QString for sorting.

Change-Id: I89921328b6d9e952c802d41998495bd2ffbb9f99
Reviewed-by: hjk <hjk@qt.io>
2023-05-10 08:56:32 +00:00
Jarek Kobus
c75b59f9b4 Process: Rename QtcProcessPrivate -> ProcessPrivate
Rename the logging category for Process.
Fix inline comments accordingly.
Adapt warning/debug messages accordingly.

Change-Id: I2b1f0f558701def3afa3c1b04adf629833dba9e7
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: hjk <hjk@qt.io>
2023-05-10 06:07:22 +00:00
Jarek Kobus
fb50e35db9 FilePath: Fix hash function
For better performance, include also the scheme and host in qHash
calculation.

Change-Id: I2a69a128597429b88a71943d248ce038b49285f2
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: hjk <hjk@qt.io>
2023-05-05 13:40:31 +00:00
Eike Ziller
3ba769fb46 Fix saving of hardlinked files
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>
2023-04-12 08:47:53 +00:00
hjk
305ccfe259 Utils: Replace FilePath::onDevice() by new FilePath::withMappedPath()
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>
2023-04-04 06:56:55 +00:00
Orgad Shaneh
9956740905 FilePath: Optimize string compare in setParts
Change-Id: Ibc390ee943ed41dfef30fbbd07e2e681d82379ba
Reviewed-by: hjk <hjk@qt.io>
2023-04-04 06:14:12 +00:00
Tim Jenssen
adb664f521 Merge remote-tracking branch 'origin/qds/dev'
Conflicts: src/libs/utils/filepath.cpp
  src/plugins/qmldesigner/qmldesignerexternaldependencies.cpp
  src/plugins/qmlprojectmanager/cmakegen/generatecmakelists.cpp
  tests/unit/unittest/CMakeLists.txt

Change-Id: I017a6075db41a5233487ac855ffe23de2b2bb0ee
2023-03-30 13:30:42 +00:00
Tim Jenßen
feabda3aa7 Merge remote-tracking branch 'origin/10.0' into qds/dev
bigger conflicts resolved at:
  src/plugins/qmldesigner/CMakeLists.txt
  src/plugins/qmlprojectmanager/qmlprojectrunconfiguration.cpp

Change-Id: I08e2a109d8e37cbd77225129854e9e633725bfc7
2023-03-26 16:26:18 +02:00
hjk
b4bc5f6e1b Utils: Add short documentation for two FilePath functions
ensureWriteableDir() and createDir()

Also change a few \returns to Returns.

Change-Id: I8c80616a465a7e665ff56fab8279e43e5755fb4f
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
2023-03-24 10:59:39 +00:00
Marcus Tillmanns
29873068eb Utils: Store Device::osType in settings
Change-Id: I41348be752598b7a8d1f1979764e7111cccc95a9
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2023-03-23 12:33:58 +00:00
Jarek Kobus
81bd8e3bd8 FilePath: Remove overloads for async tasks that don't take context
Passing mandatory context object clearly suggests a special
care should be taken for assuring the passed function
may still run when the task finishes in the future.

Fix FileStreamManager so that it deletes the streamer
even when context object was deleted in meantime.

Fix 2 usages of asyncCopy so that we pass a context object now.

Side note: passing nullptr as a context object is still
possible and should work, but it's not recommended.

Change-Id: I464438db42ed9292c2f89ecb9d5dde7c78f77640
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: hjk <hjk@qt.io>
2023-03-17 14:30:59 +00:00
Jarek Kobus
44655995d1 FilePath: Provide overloads for async tasks taking context object
Change-Id: I0bb2f2bfc0f54e8a81efb7d9279d539bcdfd9bc9
Reviewed-by: hjk <hjk@qt.io>
2023-03-17 10:21:59 +00:00
Jarek Kobus
69fa8f3f3c FilePath: Integrate FileStreamerManager for async i-face
Change-Id: I3371471e3c23b86a62b5e4056b343941ab46e191
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: hjk <hjk@qt.io>
2023-03-07 12:22:40 +00:00
Tim Jenssen
cc6c9e4b5e FilePath: fix documentation
Change-Id: Icd2ea0842279ac5ca9225b760aa7634b8db3e06d
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2023-03-02 11:28:26 +00:00
Eike Ziller
380f7622de Merge remote-tracking branch 'origin/10.0'
Conflicts:
	src/plugins/debugger/watchhandler.cpp

Change-Id: If759b6260dfa008738d3a0ce543eb0eead8a8bba
2023-02-27 09:48:12 +01:00
Leena Miettinen
708c629133 Utils: Use double quotes for emphasis in UI text
Change-Id: I00b27ee40ba131ec6472b03ac7f23c93639a9cea
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
2023-02-24 16:51:27 +00:00
Marcus Tillmanns
a62c5cf89a Utils: Cleanup searchInX functions
Also move some often used types into new file "utiltypes.h"

Change-Id: I3f152d1dc2f96ba0259ad6c098d9ac5ee03a59f1
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: hjk <hjk@qt.io>
2023-02-24 15:13:32 +00:00
Marcus Tillmanns
d5a9e28a96 Utils: Add tst_filepath
Moves all tests that are applicable only to FilePath over from
tst_fileutils.

Change-Id: Ic331e1470a7479ee2f8ba38baec84124982a000a
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2023-02-24 09:45:56 +00:00
Marcus Tillmanns
00fd4c8fea Utils: Fix diriterator for scheme folders
Previously the "fileName" of every device inside a scheme subfolder
would be empty. Therefore QDirIterator would skip them.

Change-Id: Ifa46859aadbd8a81364a1fe0a72b9a50a7a396ca
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-02-23 10:25:15 +00:00
Eike Ziller
37ec527e6d Fix tilde expansion in FilePath::fromUserInput
It was not working for just "~/" without additional path component.

Change-Id: I559a7771fc09d2e604f567548585a668e8809729
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2023-02-23 07:12:15 +00:00
Marcus Tillmanns
8ed10639b6 Utils: Make getFileAccess static
Change-Id: I6af1ee8be88bf378bd1ddff8fee02005cc9ed6cb
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2023-02-17 11:22:50 +00:00
Marcus Tillmanns
1523f49e5c Utils: Add PathFilter to FilePath::searchInPath
Change-Id: Iccbecc7401f17208487113f89e49ed7103acf9d6
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: hjk <hjk@qt.io>
2023-02-09 11:56:28 +00:00
Marcus Tillmanns
516fce6f53 Utils: Add FilePath::tmpDir and createTempFile
Change-Id: I6f3143e59a87edffeee5e08708ba721293a8a369
Reviewed-by: hjk <hjk@qt.io>
2023-02-07 09:28:38 +00:00
Marcus Tillmanns
0c1b59fb1a Utils: Use isSameDevice in copyFile
Change-Id: I36389a88c4474d46ef4fdb9369cf9f4219f6099d
Reviewed-by: hjk <hjk@qt.io>
2023-02-07 08:17:16 +00:00
Alessandro Portale
4d6827dde9 Utils: Tr::tr
Change-Id: Ic03e20993f05fb5b49a12c891d86afb2c8e18e08
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: hjk <hjk@qt.io>
2023-02-01 13:48:22 +00:00
hjk
1285b80c40 Utils: Use an enum indication the possible abort of an dir iteration
The bool is not really clear.

Change-Id: I4ce6412736aec6b1853fd53d4e535ad045748350
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2023-01-26 07:38:21 +00:00
Marcus Tillmanns
7cb74e325f Utils: Add FilePath::copyRecursively
Change-Id: I0cb07158906a5e163ea35670f46f3b4fd9ec40b8
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-01-25 07:29:52 +00:00
hjk
34fd5b3ced Utils: Improve FilePath::toUrl for local cases
Change-Id: If1674f97eeeb91173dc2b482662228c1c3f0f332
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2023-01-24 08:33:43 +00:00
Christian Stenger
d9de9db6f8 Utils: Adapt to change in FilePath
Change-Id: Ibd3c53c49390cbf77d8b0563bab7ddff216394c7
Reviewed-by: hjk <hjk@qt.io>
2023-01-19 05:34:48 +00:00