summaryrefslogtreecommitdiff
path: root/src/organizercore.cpp
diff options
context:
space:
mode:
authorisanae <14251494+isanae@users.noreply.github.com>2020-07-18 05:30:57 -0400
committerisanae <14251494+isanae@users.noreply.github.com>2020-11-03 11:39:02 -0500
commitf4ca82f798fa7e456bb904ed301ddc17db5410c8 (patch)
tree4f27efe8f211ba5eb81a5e728b8d5d4ae7de4ed5 /src/organizercore.cpp
parentccab9eae8df3cf5367ce5cf164c98d1534ac13cb (diff)
fixed handling of profile names with different casing than on the filesystem
added --instance
Diffstat (limited to 'src/organizercore.cpp')
-rw-r--r--src/organizercore.cpp19
1 files changed, 17 insertions, 2 deletions
diff --git a/src/organizercore.cpp b/src/organizercore.cpp
index f9cafc95..a9469e6e 100644
--- a/src/organizercore.cpp
+++ b/src/organizercore.cpp
@@ -555,9 +555,24 @@ void OrganizerCore::setCurrentProfile(const QString &profileName)
log::debug("selecting profile '{}'", profileName);
QDir profileBaseDir(settings().paths().profiles());
- QString profileDir = profileBaseDir.absoluteFilePath(profileName);
- if (!QDir(profileDir).exists()) {
+ const auto subdirs = profileBaseDir.entryList(
+ QDir::AllDirs | QDir::NoDotAndDotDot);
+
+ QString profileDir;
+
+ // the profile name may not have the correct case, which breaks other parts
+ // of the ui like the profile combobox, which walks directories on its own
+ //
+ // find the real name with the correct case by walking the directories
+ for (auto&& dirName : subdirs) {
+ if (QString::compare(dirName, profileName, Qt::CaseInsensitive) == 0) {
+ profileDir = profileBaseDir.absoluteFilePath(dirName);
+ break;
+ }
+ }
+
+ if (profileDir.isEmpty()) {
log::error("profile '{}' does not exist", profileName);
// selected profile doesn't exist. Ensure there is at least one profile,