forked from qt-creator/qt-creator
Utils: Make a FilePath's osType publicly accessible
Will help with proper is{Relative,Absolute}Path implementations. Change-Id: Icad90b5a55d9cf733f6ee66dbbe273ec9682d387 Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -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()) {
|
||||
|
@@ -174,6 +174,7 @@ public:
|
||||
bool isNewerThan(const QDateTime &timeStamp) const;
|
||||
QDateTime lastModified() const;
|
||||
QFile::Permissions permissions() const;
|
||||
OsType osType() const;
|
||||
bool removeFile() const;
|
||||
bool removeRecursively(QString *error = nullptr) const;
|
||||
bool copyFile(const FilePath &target) const;
|
||||
|
Reference in New Issue
Block a user