Skip to content

Commit

Permalink
Show filepath using native separators (backslash on Windows)
Browse files Browse the repository at this point in the history
  • Loading branch information
cbjeukendrup committed Jul 4, 2023
1 parent 0b1c292 commit 1f4647d
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
13 changes: 13 additions & 0 deletions src/framework/global/io/path.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@
*/
#include "path.h"

#ifndef NO_QT_SUPPORT
#include <QDir>
#endif

#include "stringutils.h"
#include "fileinfo.h"

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

return result;
}

path_t mu::io::toNativeSeparators(const path_t& path)
{
#ifndef NO_QT_SUPPORT
return QDir::toNativeSeparators(path.toQString());
#else
return path;
#endif
}
2 changes: 2 additions & 0 deletions src/framework/global/io/path.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@ bool isAbsolute(const path_t& path);
bool isAllowedFileName(const path_t& fn);
path_t escapeFileName(const path_t& fn);

path_t toNativeSeparators(const path_t& path);

paths_t pathsFromString(const std::string& str, const std::string& delim = ";");
std::string pathsToString(const paths_t& ps, const std::string& delim = ";");
}
Expand Down
2 changes: 1 addition & 1 deletion src/project/internal/projectactionscontroller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1410,7 +1410,7 @@ bool ProjectActionsController::askIfUserAgreesToOpenProjectWithIncompatibleVersi

void ProjectActionsController::warnFileTooNew(const io::path_t& filepath)
{
interactive()->error(qtrc("project", "Cannot read file %1").arg(filepath.toQString()).toStdString(),
interactive()->error(qtrc("project", "Cannot read file %1").arg(io::toNativeSeparators(filepath).toQString()).toStdString(),
trc("project", "This file was saved using a newer version of MuseScore. "
"Please visit <a href=\"https://musescore.org\">musescore.org</a> to obtain the latest version."));
}
Expand Down

0 comments on commit 1f4647d

Please sign in to comment.