forked from qt-creator/qt-creator
Utils: Implement FilePath::withExecutableSuffix()
Change-Id: Ibf6919991b229eb91953b3c5b5cbb75a1be7ff5d Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -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.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user