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 =
 | 
			
		||||
      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);
 | 
			
		||||
@ -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"));
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  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";
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user