fileio.cpp: Remove optional second argument of path_iterator::next

This commit is contained in:
AJR 2022-02-17 17:28:31 -05:00
parent 5668cd4d79
commit 2db924e5ec
4 changed files with 14 additions and 11 deletions

View File

@ -107,7 +107,7 @@ path_iterator &path_iterator::operator=(path_iterator const &that)
// multipath sequence
//-------------------------------------------------
bool path_iterator::next(std::string &buffer, const char *name)
bool path_iterator::next(std::string &buffer)
{
// if none left, return false to indicate we are done
if (!m_is_first && (m_searchpath.cend() == m_current))
@ -120,10 +120,6 @@ bool path_iterator::next(std::string &buffer, const char *name)
if (m_searchpath.cend() != m_current)
++m_current;
// append the name if we have one
if (name)
util::path_append(buffer, name);
// bump the index and return true
m_is_first = false;
return true;
@ -160,9 +156,13 @@ const osd::directory::entry *file_enumerator::next(const char *subdir)
while (!m_curdir)
{
// if we fail to get anything more, we're done
if (!m_iterator.next(m_pathbuffer, subdir))
if (!m_iterator.next(m_pathbuffer))
return nullptr;
// append the subdir if we have one
if (subdir)
util::path_append(m_pathbuffer, subdir);
// open the path
m_curdir = osd::directory::open(m_pathbuffer);
}

View File

@ -61,7 +61,7 @@ public:
path_iterator &operator=(path_iterator const &that);
// main interface
bool next(std::string &buffer, const char *name = nullptr);
bool next(std::string &buffer);
void reset();
private:

View File

@ -20,6 +20,7 @@
#include "softlist_dev.h"
#include "chd.h"
#include "path.h"
#include <algorithm>
@ -423,8 +424,10 @@ media_auditor::summary media_auditor::audit_samples()
emu_file file(m_enumerator.options().sample_path(), OPEN_FLAG_READ | OPEN_FLAG_NO_PRELOAD);
path_iterator path(searchpath);
std::string curpath;
while (path.next(curpath, samplename))
while (path.next(curpath))
{
util::path_append(curpath, samplename);
// attempt to access the file (.flac) or (.wav)
std::error_condition filerr = file.open(curpath + ".flac");
if (filerr)

View File

@ -183,7 +183,7 @@ void menu_display_actual::populate(float &customtop, float &custombottom)
path_iterator path(m_searchpath);
std::string curpath;
m_folders.clear();
while (path.next(curpath, nullptr))
while (path.next(curpath))
m_folders.push_back(curpath);
item_append((s_folders[m_ref].action == CHANGE) ? _("Change Folder") : _("Add Folder"), 0, (void *)ADD_CHANGE);
@ -238,7 +238,7 @@ menu_add_change_folder::menu_add_change_folder(mame_ui_manager &mui, render_cont
path_iterator path(searchpath);
std::string curpath;
while (path.next(curpath, nullptr))
while (path.next(curpath))
m_folders.push_back(curpath);
}
@ -464,7 +464,7 @@ menu_remove_folder::menu_remove_folder(mame_ui_manager &mui, render_container &c
path_iterator path(m_searchpath);
std::string curpath;
while (path.next(curpath, nullptr))
while (path.next(curpath))
m_folders.push_back(curpath);
}