Utils: Rename FilePath::deviceLocalPath() to nativePath()

Change-Id: Id2b2b7d54a536d569c6dc717365ee28421e2b56b
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
hjk
2021-11-10 16:19:25 +01:00
parent 40c04a4fe4
commit 3fd1122759
4 changed files with 8 additions and 8 deletions

View File

@@ -57,7 +57,7 @@ void Environment::appendOrSetPath(const FilePath &value)
QTC_CHECK(value.osType() == m_osType); QTC_CHECK(value.osType() == m_osType);
if (value.isEmpty()) if (value.isEmpty())
return; return;
appendOrSet("PATH", value.deviceLocalPath(), appendOrSet("PATH", value.nativePath(),
QString(OsSpecificAspects::pathListSeparator(m_osType))); QString(OsSpecificAspects::pathListSeparator(m_osType)));
} }
@@ -66,7 +66,7 @@ void Environment::prependOrSetPath(const FilePath &value)
QTC_CHECK(value.osType() == m_osType); QTC_CHECK(value.osType() == m_osType);
if (value.isEmpty()) if (value.isEmpty())
return; return;
prependOrSet("PATH", value.deviceLocalPath(), prependOrSet("PATH", value.nativePath(),
QString(OsSpecificAspects::pathListSeparator(m_osType))); QString(OsSpecificAspects::pathListSeparator(m_osType)));
} }
@@ -104,12 +104,12 @@ void Environment::prependOrSetLibrarySearchPath(const FilePath &value)
switch (m_osType) { switch (m_osType) {
case OsTypeWindows: { case OsTypeWindows: {
const QChar sep = ';'; const QChar sep = ';';
prependOrSet("PATH", value.deviceLocalPath(), QString(sep)); prependOrSet("PATH", value.nativePath(), QString(sep));
break; break;
} }
case OsTypeMac: { case OsTypeMac: {
const QString sep = ":"; const QString sep = ":";
const QString nativeValue = value.deviceLocalPath(); const QString nativeValue = value.nativePath();
prependOrSet("DYLD_LIBRARY_PATH", nativeValue, sep); prependOrSet("DYLD_LIBRARY_PATH", nativeValue, sep);
prependOrSet("DYLD_FRAMEWORK_PATH", nativeValue, sep); prependOrSet("DYLD_FRAMEWORK_PATH", nativeValue, sep);
break; break;
@@ -117,7 +117,7 @@ void Environment::prependOrSetLibrarySearchPath(const FilePath &value)
case OsTypeLinux: case OsTypeLinux:
case OsTypeOtherUnix: { case OsTypeOtherUnix: {
const QChar sep = ':'; const QChar sep = ':';
prependOrSet("LD_LIBRARY_PATH", value.deviceLocalPath(), QString(sep)); prependOrSet("LD_LIBRARY_PATH", value.nativePath(), QString(sep));
break; break;
} }
default: default:

View File

@@ -490,7 +490,7 @@ QString FilePath::toUserOutput() const
/// \returns a QString to pass to target system native commands, without the device prefix. /// \returns a QString to pass to target system native commands, without the device prefix.
/// Converts the separators to the native format of the system /// Converts the separators to the native format of the system
/// this path belongs to. /// this path belongs to.
QString FilePath::deviceLocalPath() const QString FilePath::nativePath() const
{ {
QString data = m_data; QString data = m_data;
if (osType() == OsTypeWindows) if (osType() == OsTypeWindows)

View File

@@ -66,7 +66,6 @@ public:
[[nodiscard]] static FilePath fromUrl(const QUrl &url); [[nodiscard]] static FilePath fromUrl(const QUrl &url);
QString toUserOutput() const; QString toUserOutput() const;
QString deviceLocalPath() const;
QString toString() const; QString toString() const;
QVariant toVariant() const; QVariant toVariant() const;
QUrl toUrl() const; QUrl toUrl() const;
@@ -167,6 +166,7 @@ public:
// on Windows and macOS. This is rarely needed. // on Windows and macOS. This is rarely needed.
[[nodiscard]] FilePath normalizedPathName() const; [[nodiscard]] FilePath normalizedPathName() const;
QString nativePath() const;
QString shortNativePath() const; QString shortNativePath() const;
bool startsWithDriveLetter() const; bool startsWithDriveLetter() const;

View File

@@ -163,7 +163,7 @@ QTCREATOR_UTILS_EXPORT bool is64BitWindowsBinary(const FilePath &binaryIn)
# endif # endif
bool isAmd64 = false; bool isAmd64 = false;
DWORD binaryType = 0; DWORD binaryType = 0;
const QString binary = binaryIn.deviceLocalPath(); const QString binary = binaryIn.nativePath();
bool success = GetBinaryTypeW(reinterpret_cast<const TCHAR*>(binary.utf16()), &binaryType) != 0; bool success = GetBinaryTypeW(reinterpret_cast<const TCHAR*>(binary.utf16()), &binaryType) != 0;
if (success && binaryType == SCS_64BIT_BINARY) if (success && binaryType == SCS_64BIT_BINARY)
isAmd64=true; isAmd64=true;