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>
Moves all tests that are applicable only to FilePath over from
tst_fileutils.
Change-Id: Ic331e1470a7479ee2f8ba38baec84124982a000a
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
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>
FilePath::hasFileAccess allows a user to test if a specific device
can access files. This is faster than calling "exists()" as it does
not have to actually check anything on the device.
Task-number: QTCREATORBUG-28531
Change-Id: I94b5b9e0ae020b81f126c61fd06bb25f3d4a88cb
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Specifies the main purpose more clearly. The remaining ones a "true"
(internal) variants in models and as action data.
Change-Id: I8dd3c846e419f29d88283c2f48268ef6685b19fe
Reviewed-by: Eike Ziller <eike.ziller@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>
The distiction relative/absolute path is not broad enough to
cover all situations like e.g. Windows paths with drive letter
but not starting with backslash, and generally also rarely needed
in user code. The situation doesn't get better with "convenience
defaults", like empty path meaning depending on context.
Mid-term I'd like to ramp down uses in user code, moving corner-case
handling to filepath.cpp behind "higher level" FilePath API.
This here is one step towards this goal.
Change-Id: I070112810a1628ced035e90cc7dc679e2248d688
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
FilePath::localSource can return a filepath that represents a local version
of a remote file.
It is used to let the debugger select the local version of a file when
debugging a remote target.
Change-Id: Ieb934ef0d454e8ff55e71df41dca825974d85da7
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: hjk <hjk@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>
Even though the concepts are similar, direct conversion is
usually neither desired (lossy) nor needed.
Change-Id: Id5c9e69d0597ed867cbda25f3fc4619a9fe90966
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This was a alias for .stringAppended(), but can be used too easily
when .pathAppended() is meant.
Change-Id: Ia3b64d39828d4074b43d87c923ce3a6a87038948
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Mostly for shorter code, but also save a few cycles due to less
string construction and run time dispatch.
Also, make testFilePathFromToString() test two paths instead one path
twice.
Change-Id: I50a3145bca1a4b262a15e96173ea7ebd9cb678ad
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
Reviewed-by: hjk <hjk@qt.io>
* The QTC_ASSERT in pathView() is quite expensive
* Constructing the scheme using scheme() is not required
Change-Id: Ibea33dd6abf67c8bd184d118f23e2598075c362c
Reviewed-by: hjk <hjk@qt.io>
(cherry picked from commit e471417539)
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>