Bugfix: custom paths were not stored correctly

Now, if a path is stored with a category (i.e. mypath:macros),
the path is not modified. Instead, the path is taken as is
for the specific category.

Only unspecific paths are taken for by mypath/macros,
mypath/pymacros etc.
This commit is contained in:
Matthias Koefferlein 2017-10-03 16:49:28 +02:00
parent 67fb59b514
commit ff73583d26
2 changed files with 8 additions and 3 deletions

View File

@ -560,7 +560,7 @@ Application::Application (int &argc, char **argv, bool non_ui_mode)
} else if (a == "-j" && (i + 1) < argc) {
custom_macro_paths.push_back (std::pair<std::string, std::string> (args [++i], "macros"));
custom_macro_paths.push_back (std::pair<std::string, std::string> (args [++i], std::string ()));
} else if (a == "-nt") {
@ -678,7 +678,7 @@ Application::Application (int &argc, char **argv, bool non_ui_mode)
while (! ex.at_end ()) {
std::string p;
ex.read_word_or_quoted (p);
custom_macro_paths.push_back (std::pair<std::string, std::string> (p, "macros"));
custom_macro_paths.push_back (std::pair<std::string, std::string> (p, std::string ()));
if (ex.test (":")) {
ex.read_word (custom_macro_paths.back ().second);
}

View File

@ -68,7 +68,12 @@ MacroController::load ()
for (size_t c = 0; c < m_macro_categories.size (); ++c) {
if (p->cat.empty () || p->cat == m_macro_categories [c].first) {
std::string mp = tl::to_string (QDir (tl::to_qstring (p->path)).absoluteFilePath (tl::to_qstring (m_macro_categories [c].first)));
std::string mp;
if (p->cat.empty ()) {
mp = tl::to_string (QDir (tl::to_qstring (p->path)).absoluteFilePath (tl::to_qstring (m_macro_categories [c].first)));
} else {
mp = p->path;
}
lym::MacroCollection::root ().add_folder (p->description, mp, m_macro_categories [c].first, p->readonly);
}
}