From e4ac53f359df2b0e0a7c181625321d2827e636da Mon Sep 17 00:00:00 2001 From: Nodir Temirkhodjaev Date: Sun, 17 Mar 2019 22:14:04 +0500 Subject: [PATCH] UI: Minor fix. --- src/ui/driver/drivermanager.cpp | 4 ++-- src/ui/util/fileutil.cpp | 5 +++++ src/ui/util/fileutil.h | 1 + 3 files changed, 8 insertions(+), 2 deletions(-) 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);