From 109947ba3f50b00ab681a86ae1d8dc9dfecb8f4e Mon Sep 17 00:00:00 2001 From: Markus Goetz Date: Tue, 24 Jul 2018 15:41:26 +0200 Subject: [PATCH] Settings: Attempt to fix rename issue on old macOS Found by @hurradieweltgehtunter --- src/gui/application.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/gui/application.cpp b/src/gui/application.cpp index 386215764..348b8dabb 100644 --- a/src/gui/application.cpp +++ b/src/gui/application.cpp @@ -125,7 +125,8 @@ Application::Application(int &argc, char **argv) setAttribute(Qt::AA_UseHighDpiPixmaps, true); auto confDir = ConfigFile().configPath(); - if (!QFileInfo(confDir).exists()) { + if (confDir.endsWith('/')) confDir.chop(1); // macOS 10.11.x does not like trailing slash for rename/move. + if (!QFileInfo(confDir).isDir()) { // Migrate from version <= 2.4 setApplicationName(_theme->appNameGUI()); #ifndef QT_WARNING_DISABLE_DEPRECATED // Was added in Qt 5.9 @@ -136,6 +137,7 @@ Application::Application(int &argc, char **argv) // We need to use the deprecated QDesktopServices::storageLocation because of its Qt4 // behavior of adding "data" to the path QString oldDir = QDesktopServices::storageLocation(QDesktopServices::DataLocation); + if (oldDir.endsWith('/')) oldDir.chop(1); // macOS 10.11.x does not like trailing slash for rename/move. QT_WARNING_POP setApplicationName(_theme->appName()); if (QFileInfo(oldDir).isDir()) {