ui/state.cpp: Use path concatenation utility function.

This commit is contained in:
Vas Crabb 2022-11-26 01:51:31 +11:00
parent c57e1e7e40
commit 9e2f2519f6

View File

@ -374,12 +374,10 @@ void menu_load_save_state_base::handle_keys(uint32_t flags, int &iptkey)
if (exclusive_input_pressed(iptkey, IPT_UI_SELECT, 0)) if (exclusive_input_pressed(iptkey, IPT_UI_SELECT, 0))
{ {
// try to remove the file // try to remove the file
std::string const filename(util::string_format( std::string const filename(util::path_concat(
"%2$s%1$s%3$s%1$s%4$s.sta",
PATH_SEPARATOR,
machine().options().state_directory(), machine().options().state_directory(),
machine().get_statename(machine().options().state_name()), machine().get_statename(machine().options().state_name()),
m_confirm_delete->file_name())); m_confirm_delete->file_name() + ".sta"));
std::error_condition const err(osd_file::remove(filename)); std::error_condition const err(osd_file::remove(filename));
if (err) if (err)
{ {
@ -485,11 +483,9 @@ const menu_load_save_state_base::file_entry &menu_load_save_state_base::file_ent
std::string menu_load_save_state_base::state_directory() const std::string menu_load_save_state_base::state_directory() const
{ {
const char *stateopt = machine().options().state_name(); return util::path_concat(
return util::string_format("%s%s%s",
machine().options().state_directory(), machine().options().state_directory(),
PATH_SEPARATOR, machine().get_statename(machine().options().state_name()));
machine().get_statename(stateopt));
} }