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))
{
// try to remove the file
std::string const filename(util::string_format(
"%2$s%1$s%3$s%1$s%4$s.sta",
PATH_SEPARATOR,
std::string const filename(util::path_concat(
machine().options().state_directory(),
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));
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
{
const char *stateopt = machine().options().state_name();
return util::string_format("%s%s%s",
return util::path_concat(
machine().options().state_directory(),
PATH_SEPARATOR,
machine().get_statename(stateopt));
machine().get_statename(machine().options().state_name()));
}