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>
This commit is contained in:
parent
f40b3d162d
commit
7301e62c73
@ -4468,7 +4468,7 @@ void Courtroom::set_iniswap_dropdown()
|
|||||||
}
|
}
|
||||||
QStringList iniswaps =
|
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_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)
|
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));
|
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))
|
if (!swaplist.contains(entry) && entry != char_list.at(m_cid).name && !defswaplist.contains(entry))
|
||||||
swaplist.append(entry);
|
swaplist.append(entry);
|
||||||
}
|
}
|
||||||
ao_app->write_to_file(
|
QString p_path = ao_app->get_real_path(VPath("iniswaps.ini"));
|
||||||
swaplist.join("\n"),
|
if (!file_exists(p_path)) {
|
||||||
ao_app->get_base_path() + "iniswaps.ini");
|
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->blockSignals(true);
|
||||||
ui_iniswap_dropdown->setCurrentIndex(p_index);
|
ui_iniswap_dropdown->setCurrentIndex(p_index);
|
||||||
ui_iniswap_dropdown->blockSignals(false);
|
ui_iniswap_dropdown->blockSignals(false);
|
||||||
@ -4586,8 +4588,7 @@ void Courtroom::set_sfx_dropdown()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Append default sound list after the character sound list.
|
// Append default sound list after the character sound list.
|
||||||
sound_list += ao_app->get_list_file(
|
sound_list += ao_app->get_list_file(VPath("soundlist.ini"));
|
||||||
ao_app->get_base_path() + "soundlist.ini");
|
|
||||||
|
|
||||||
QStringList display_sounds;
|
QStringList display_sounds;
|
||||||
for (const QString &sound : qAsConst(sound_list)) {
|
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,
|
menu->addAction(QString("Edit " + current_char + "/soundlist.ini"), this,
|
||||||
&Courtroom::on_sfx_edit_requested);
|
&Courtroom::on_sfx_edit_requested);
|
||||||
else
|
else
|
||||||
menu->addAction(QString("Edit global soundlist.ini"), this,
|
menu->addAction(QString("Edit base soundlist.ini"), this,
|
||||||
&Courtroom::on_sfx_edit_requested);
|
&Courtroom::on_sfx_edit_requested);
|
||||||
if (!custom_sfx.isEmpty())
|
if (!custom_sfx.isEmpty())
|
||||||
menu->addAction(QString("Clear Edit Text"), this, &Courtroom::on_sfx_remove_clicked);
|
menu->addAction(QString("Clear Edit Text"), this, &Courtroom::on_sfx_remove_clicked);
|
||||||
@ -4654,6 +4655,10 @@ void Courtroom::on_sfx_edit_requested()
|
|||||||
p_path = ao_app->get_real_path(ao_app->get_character_path(current_char, "sounds.ini"));
|
p_path = ao_app->get_real_path(ao_app->get_character_path(current_char, "sounds.ini"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!file_exists(p_path)) {
|
||||||
|
p_path = ao_app->get_real_path(VPath("soundlist.ini"));
|
||||||
|
}
|
||||||
|
|
||||||
if (!file_exists(p_path)) {
|
if (!file_exists(p_path)) {
|
||||||
p_path = ao_app->get_base_path() + "soundlist.ini";
|
p_path = ao_app->get_base_path() + "soundlist.ini";
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user