Utils: Re-do FilePath::toUserOutput()

Use the FilePath's knowledge of the target os instead of always using
the host os.

Change-Id: I996db68486f4616c8636ae501cce7a778269f1cf
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
hjk
2021-09-28 15:11:26 +02:00
parent c252fa9367
commit afe60b1669

View File

@@ -477,12 +477,14 @@ void FileUtils::setDeviceFileHooks(const DeviceFileHooks &hooks)
} }
/// \returns a QString to display to the user /// \returns a QString to display to the user
/// Converts the separators to the native format /// Converts the separators to the native format of the system
/// this path belongs to.
QString FilePath::toUserOutput() const QString FilePath::toUserOutput() const
{ {
if (m_scheme.isEmpty()) FilePath tmp = *this;
return QDir::toNativeSeparators(m_data); if (osType() == OsTypeWindows)
return toString(); tmp.m_data.replace('/', '\\');
return tmp.toString();
} }
QString FilePath::fileName() const QString FilePath::fileName() const