Skip to content

Commit 632c5a5

Browse files
committed
Show filepath using native separators (backslash on Windows)
1 parent fcec897 commit 632c5a5

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

src/framework/global/io/path.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@
2121
*/
2222
#include "path.h"
2323

24+
#ifndef NO_QT_SUPPORT
25+
#include <QDir>
26+
#endif
27+
2428
#include "stringutils.h"
2529
#include "fileinfo.h"
2630

@@ -273,3 +277,12 @@ std::string mu::io::pathsToString(const paths_t& ps, const std::string& delim)
273277

274278
return result;
275279
}
280+
281+
path_t mu::io::toNativeSeparators(const path_t& path)
282+
{
283+
#ifndef NO_QT_SUPPORT
284+
return QDir::toNativeSeparators(path.toQString());
285+
#else
286+
return path;
287+
#endif
288+
}

src/framework/global/io/path.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,8 @@ bool isAbsolute(const path_t& path);
109109
bool isAllowedFileName(const path_t& fn);
110110
path_t escapeFileName(const path_t& fn);
111111

112+
path_t toNativeSeparators(const path_t& path);
113+
112114
paths_t pathsFromString(const std::string& str, const std::string& delim = ";");
113115
std::string pathsToString(const paths_t& ps, const std::string& delim = ";");
114116
}

src/project/internal/projectactionscontroller.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1445,7 +1445,7 @@ void ProjectActionsController::warnProjectCriticallyCorrupted(const String& proj
14451445

14461446
void ProjectActionsController::warnProjectCannotBeOpened(const Ret& ret, const io::path_t& filepath)
14471447
{
1448-
std::string title = mtrc("project", "Cannot read file %1").arg(filepath.toString()).toStdString();
1448+
std::string title = mtrc("project", "Cannot read file %1").arg(io::toNativeSeparators(filepath).toString()).toStdString();
14491449
std::string body;
14501450

14511451
switch (ret.code()) {

0 commit comments

Comments
 (0)