diff options
| author | Crystalwarrior <Varsash@Gmail.com> | 2022-07-29 04:29:32 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-07-28 20:29:32 -0500 |
| commit | 7301e62c737f17da55be71b9e93e96ef38f7a1ba (patch) | |
| tree | a121045ddd25ced16996cdb6b37a26a855a0f1cd | |
| parent | f40b3d162da708e77bea2836701b867060ce9f6d (diff) | |
Fix iniswaps.ini and soundlist.ini not using vpath (#714)
Fixes #670
Co-authored-by: stonedDiscord <Tukz@gmx.de>
Co-authored-by: oldmud0 <oldmud0@users.noreply.github.com>
| -rw-r--r-- | src/courtroom.cpp | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/src/courtroom.cpp b/src/courtroom.cpp index f39ec820..7a65391a 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -4468,7 +4468,7 @@ void Courtroom::set_iniswap_dropdown() } QStringList iniswaps = ao_app->get_list_file(ao_app->get_character_path(char_list.at(m_cid).name, "iniswaps.ini")) + - ao_app->get_list_file(ao_app->get_base_path() + "iniswaps.ini"); + ao_app->get_list_file(VPath("iniswaps.ini")); if (ao_app->get_char_name(char_list.at(m_cid).name) != char_list.at(m_cid).name) iniswaps.append(ao_app->get_char_name(char_list.at(m_cid).name)); @@ -4510,9 +4510,11 @@ void Courtroom::on_iniswap_dropdown_changed(int p_index) if (!swaplist.contains(entry) && entry != char_list.at(m_cid).name && !defswaplist.contains(entry)) swaplist.append(entry); } - ao_app->write_to_file( - swaplist.join("\n"), - ao_app->get_base_path() + "iniswaps.ini"); + QString p_path = ao_app->get_real_path(VPath("iniswaps.ini")); + if (!file_exists(p_path)) { + p_path = ao_app->get_base_path() + "iniswaps.ini"; + } + ao_app->write_to_file(swaplist.join("\n"), p_path); ui_iniswap_dropdown->blockSignals(true); ui_iniswap_dropdown->setCurrentIndex(p_index); ui_iniswap_dropdown->blockSignals(false); @@ -4586,8 +4588,7 @@ void Courtroom::set_sfx_dropdown() } // Append default sound list after the character sound list. - sound_list += ao_app->get_list_file( - ao_app->get_base_path() + "soundlist.ini"); + sound_list += ao_app->get_list_file(VPath("soundlist.ini")); QStringList display_sounds; for (const QString &sound : qAsConst(sound_list)) { @@ -4635,7 +4636,7 @@ void Courtroom::on_sfx_context_menu_requested(const QPoint &pos) menu->addAction(QString("Edit " + current_char + "/soundlist.ini"), this, &Courtroom::on_sfx_edit_requested); else - menu->addAction(QString("Edit global soundlist.ini"), this, + menu->addAction(QString("Edit base soundlist.ini"), this, &Courtroom::on_sfx_edit_requested); if (!custom_sfx.isEmpty()) menu->addAction(QString("Clear Edit Text"), this, &Courtroom::on_sfx_remove_clicked); @@ -4655,6 +4656,10 @@ void Courtroom::on_sfx_edit_requested() } if (!file_exists(p_path)) { + p_path = ao_app->get_real_path(VPath("soundlist.ini")); + } + + if (!file_exists(p_path)) { p_path = ao_app->get_base_path() + "soundlist.ini"; } QDesktopServices::openUrl(QUrl::fromLocalFile(p_path)); |
