diff options
author | hjk <[email protected]> | 2021-06-29 16:57:16 +0200 |
---|---|---|
committer | hjk <[email protected]> | 2021-06-30 13:24:59 +0000 |
commit | a2790ac95bcec4899e450198a30ed7946124d514 (patch) | |
tree | 84963a37dba240e315e4374dd1b8b78b4ba2905d /src/libs/utils/fileutils.cpp | |
parent | 28abf32b30c4fa4d31992f505bd74c1fb026a0d5 (diff) |
Utils: Implement FilePath::withExecutableSuffix()
Change-Id: Ibf6919991b229eb91953b3c5b5cbb75a1be7ff5d
Reviewed-by: Christian Stenger <[email protected]>
Diffstat (limited to 'src/libs/utils/fileutils.cpp')
-rw-r--r-- | src/libs/utils/fileutils.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/libs/utils/fileutils.cpp b/src/libs/utils/fileutils.cpp index 1f5a7b7cbc1..1f32637cbf2 100644 --- a/src/libs/utils/fileutils.cpp +++ b/src/libs/utils/fileutils.cpp @@ -29,6 +29,7 @@ #include "algorithm.h" #include "commandline.h" #include "environment.h" +#include "hostosinfo.h" #include "qtcassert.h" #include <QDataStream> @@ -1015,6 +1016,19 @@ FilePath FilePath::symLinkTarget() const return FilePath::fromString(info.symLinkTarget()); } +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)); + return res; +} /// Find the parent directory of a given directory. |