diff --git a/src/emu/diimage.cpp b/src/emu/diimage.cpp index e163f420de4..657b3acf4a9 100644 --- a/src/emu/diimage.cpp +++ b/src/emu/diimage.cpp @@ -340,18 +340,18 @@ void device_image_interface::message(const char *format, ...) // actually exists //------------------------------------------------- -bool device_image_interface::try_change_working_directory(const char *subdir) +bool device_image_interface::try_change_working_directory(const std::string &subdir) { const osd::directory::entry *entry; bool success = false; bool done = false; - auto directory = osd::directory::open(m_working_directory.c_str()); + auto directory = osd::directory::open(m_working_directory); if (directory) { while (!done && (entry = directory->read()) != nullptr) { - if (!core_stricmp(subdir, entry->name)) + if (!core_stricmp(subdir.c_str(), entry->name)) { done = true; success = entry->type == osd::directory::entry::entry_type::DIR; @@ -714,7 +714,7 @@ image_error_t device_image_interface::load_image_by_path(UINT32 open_flags, cons // reopen_for_write //------------------------------------------------- -int device_image_interface::reopen_for_write(const char *path) +int device_image_interface::reopen_for_write(const std::string &path) { m_file.reset(); @@ -1164,7 +1164,7 @@ image_init_result device_image_interface::finish_load() // create - create a image //------------------------------------------------- -image_init_result device_image_interface::create(const char *path, const image_device_format *create_format, util::option_resolution *create_args) +image_init_result device_image_interface::create(const std::string &path, const image_device_format *create_format, util::option_resolution *create_args) { int format_index = 0; int cnt = 0; diff --git a/src/emu/diimage.h b/src/emu/diimage.h index 81a079e50a7..1d066527b49 100644 --- a/src/emu/diimage.h +++ b/src/emu/diimage.h @@ -236,9 +236,9 @@ public: bool open_image_file(emu_options &options); image_init_result finish_load(); void unload(); - image_init_result create(const char *path, const image_device_format *create_format, util::option_resolution *create_args); + image_init_result create(const std::string &path, const image_device_format *create_format, util::option_resolution *create_args); bool load_software(software_list_device &swlist, const char *swname, const rom_entry *entry); - int reopen_for_write(const char *path); + int reopen_for_write(const std::string &path); static void software_name_split(const char *swlist_swname, std::string &swlist_name, std::string &swname, std::string &swpart); static void static_set_user_loadable(device_t &device, bool user_loadable) { @@ -267,7 +267,7 @@ protected: void check_for_file() const { assert_always(m_file, "Illegal operation on unmounted image"); } void setup_working_directory(); - bool try_change_working_directory(const char *subdir); + bool try_change_working_directory(const std::string &subdir); void run_hash(void (*partialhash)(util::hash_collection &, const unsigned char *, unsigned long, const char *), util::hash_collection &hashes, const char *types); void image_checkhash(); diff --git a/src/frontend/mame/ui/floppycntrl.cpp b/src/frontend/mame/ui/floppycntrl.cpp index d18da1aee92..2c676e7cb8f 100644 --- a/src/frontend/mame/ui/floppycntrl.cpp +++ b/src/frontend/mame/ui/floppycntrl.cpp @@ -42,7 +42,7 @@ void menu_control_floppy_image::do_load_create() { floppy_image_device *fd = static_cast(&m_image); if(input_filename.compare("")==0) { - image_init_result err = fd->create(output_filename.c_str(), nullptr, nullptr); + image_init_result err = fd->create(output_filename, nullptr, nullptr); if (err != image_init_result::PASS) { machine().popmessage("Error: %s", fd->error()); return; @@ -51,7 +51,7 @@ void menu_control_floppy_image::do_load_create() } else { image_init_result err = fd->load(input_filename); if ((err == image_init_result::PASS) && (output_filename.compare("") != 0)) - err = fd->reopen_for_write(output_filename.c_str()) ? image_init_result::FAIL : image_init_result::PASS; + err = fd->reopen_for_write(output_filename) ? image_init_result::FAIL : image_init_result::PASS; if (err != image_init_result::PASS) { machine().popmessage("Error: %s", fd->error()); return; diff --git a/src/frontend/mame/ui/imgcntrl.cpp b/src/frontend/mame/ui/imgcntrl.cpp index 2cedb40a828..b046acbe66c 100644 --- a/src/frontend/mame/ui/imgcntrl.cpp +++ b/src/frontend/mame/ui/imgcntrl.cpp @@ -324,8 +324,8 @@ void menu_control_device_image::handle() break; case DO_CREATE: { - auto path = util::zippath_combine(m_current_directory.c_str(), m_current_file.c_str()); - image_init_result err = m_image.create(path.c_str(), nullptr, nullptr); + auto path = util::zippath_combine(m_current_directory, m_current_file); + image_init_result err = m_image.create(path, nullptr, nullptr); if (err != image_init_result::PASS) machine().popmessage("Error: %s", m_image.error()); stack_pop();