Skip to content

Commit

Permalink
presets: Fix loading a preset from system-wide dir would not load scr…
Browse files Browse the repository at this point in the history
…ipts too
  • Loading branch information
ywwg committed Nov 26, 2015
1 parent a22f934 commit e47ff90
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/controllers/dlgprefcontroller.cpp
Expand Up @@ -356,7 +356,14 @@ void DlgPrefController::slotLoadPreset(int chosenIndex) {
return;
}

QString presetPath = m_ui.comboBoxPreset->itemData(chosenIndex).toString();
const QString presetPath = m_ui.comboBoxPreset->itemData(chosenIndex).toString();
// When loading the preset, we only want to load from the same dir as the
// preset itself, otherwise when loading from the system-wide dir we'll
// start the search in the user's dir find the existing script,
// and do nothing.
const QFileInfo presetFileInfo(presetPath);
QList<QString> presetDirs;
presetDirs.append(presetFileInfo.canonicalPath());

ControllerPresetPointer pPreset = ControllerPresetFileHandler::loadPreset(
presetPath, ControllerManager::getPresetPaths(m_pConfig));
Expand All @@ -370,7 +377,7 @@ void DlgPrefController::slotLoadPreset(int chosenIndex) {
}

QString scriptPath = ControllerManager::getAbsolutePath(
it->name, ControllerManager::getPresetPaths(m_pConfig));
it->name, presetDirs);


QString importedScriptFileName;
Expand Down

0 comments on commit e47ff90

Please sign in to comment.