aboutsummaryrefslogtreecommitdiffstats
path: root/src/libs/utils/fileutils.cpp
diff options
context:
space:
mode:
authorhjk <[email protected]>2021-07-01 11:31:30 +0200
committerhjk <[email protected]>2021-07-02 05:36:36 +0000
commit4ba07d05c4ebed82821b4a5be4f521d0b012914c (patch)
tree4d76af10339a75956d85907c51eb57b756bf148c /src/libs/utils/fileutils.cpp
parent1db9dd058e66e55163b85aecc5a63171bc3461d4 (diff)
Utils: Make a FilePath's osType publicly accessible
Will help with proper is{Relative,Absolute}Path implementations. Change-Id: Icad90b5a55d9cf733f6ee66dbbe273ec9682d387 Reviewed-by: David Schulz <[email protected]>
Diffstat (limited to 'src/libs/utils/fileutils.cpp')
-rw-r--r--src/libs/utils/fileutils.cpp18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/libs/utils/fileutils.cpp b/src/libs/utils/fileutils.cpp
index 374f495dfd2..c1dd491bd99 100644
--- a/src/libs/utils/fileutils.cpp
+++ b/src/libs/utils/fileutils.cpp
@@ -1011,15 +1011,8 @@ FilePath FilePath::symLinkTarget() const
FilePath FilePath::withExecutableSuffix() const
{
- OsType osType;
- if (needsDevice()) {
- QTC_ASSERT(s_deviceHooks.osType, return {});
- osType = s_deviceHooks.osType(*this);
- } else {
- osType = HostOsInfo::hostOs();
- }
FilePath res = *this;
- res.setPath(OsSpecificAspects::withExecutableSuffix(osType, m_data));
+ res.setPath(OsSpecificAspects::withExecutableSuffix(osType(), m_data));
return res;
}
@@ -1427,6 +1420,15 @@ QFile::Permissions FilePath::permissions() const
return toFileInfo().permissions();
}
+OsType FilePath::osType() const
+{
+ if (needsDevice()) {
+ QTC_ASSERT(s_deviceHooks.osType, return {});
+ return s_deviceHooks.osType(*this);
+ }
+ return HostOsInfo::hostOs();
+}
+
bool FilePath::removeFile() const
{
if (needsDevice()) {