diff --git a/src/ui/driver/drivermanager.cpp b/src/ui/driver/drivermanager.cpp index 2d7662bb..d183b785 100644 --- a/src/ui/driver/drivermanager.cpp +++ b/src/ui/driver/drivermanager.cpp @@ -122,8 +122,8 @@ bool DriverManager::writeData(quint32 code, QByteArray &buf, int size) void DriverManager::reinstallDriver() { - QString binPath = FileUtil::appBinLocation(); - binPath.replace('/', '\\'); + const QString binPath = FileUtil::toNativeSeparators( + FileUtil::appBinLocation()); const QString cmdPath = qEnvironmentVariable("COMSPEC"); const QString scriptPath = binPath + "\\driver\\scripts\\reinstall-lnk.bat"; diff --git a/src/ui/util/fileutil.cpp b/src/ui/util/fileutil.cpp index 2a31b55a..127187c4 100644 --- a/src/ui/util/fileutil.cpp +++ b/src/ui/util/fileutil.cpp @@ -89,6 +89,11 @@ QString FileUtil::pathSlash(const QString &path) return path.endsWith(slash) ? path : path + slash; } +QString FileUtil::toNativeSeparators(const QString &path) +{ + return QDir::toNativeSeparators(path); +} + bool FileUtil::makePath(const QString &path) { return QDir().mkpath(path); diff --git a/src/ui/util/fileutil.h b/src/ui/util/fileutil.h index c602b578..1c87e9c1 100644 --- a/src/ui/util/fileutil.h +++ b/src/ui/util/fileutil.h @@ -26,6 +26,7 @@ public: static QString absolutePath(const QString &path); static QString pathSlash(const QString &path); + static QString toNativeSeparators(const QString &path); static bool makePath(const QString &path); static bool fileExists(const QString &filePath);