Added swpath. Allows users to specify location of loose software.

This commit is contained in:
Robbbert 2016-10-12 19:37:38 +11:00
parent e4acf3380a
commit e2718c91de
4 changed files with 26 additions and 4 deletions

View File

@ -377,11 +377,29 @@ bool device_image_interface::try_change_working_directory(const std::string &sub
void device_image_interface::setup_working_directory()
{
// first set up the working directory to be the starting directory
osd_get_full_path(m_working_directory, ".");
bool success = false;
// get user-specified directory and make sure it exists
m_working_directory = device().mconfig().options().sw_path();
// if multipath, get first
size_t i = m_working_directory.find_first_of(";");
if (i != std::string::npos)
m_working_directory.resize(i);
// validate directory
if (!m_working_directory.empty())
if (osd::directory::open(m_working_directory))
success = true;
// now try browsing down to "software"
if (try_change_working_directory("software"))
// if not exist, use previous method
if (!success)
{
// first set up the working directory to be the starting directory
osd_get_full_path(m_working_directory, ".");
// now try browsing down to "software"
if (try_change_working_directory("software"))
success = true;
}
if (success)
{
// now down to a directory for this computer
int gamedrv = driver_list::find(device().machine().system());

View File

@ -39,6 +39,7 @@ const options_entry emu_options::s_option_entries[] =
{ OPTION_CROSSHAIRPATH, "crosshair", OPTION_STRING, "path to crosshair files" },
{ OPTION_PLUGINSPATH, "plugins", OPTION_STRING, "path to plugin files" },
{ OPTION_LANGUAGEPATH, "language", OPTION_STRING, "path to language files" },
{ OPTION_SWPATH, "software", OPTION_STRING, "path to loose software" },
// output directory options
{ nullptr, nullptr, OPTION_HEADER, "CORE OUTPUT DIRECTORY OPTIONS" },

View File

@ -36,6 +36,7 @@
#define OPTION_CROSSHAIRPATH "crosshairpath"
#define OPTION_PLUGINSPATH "pluginspath"
#define OPTION_LANGUAGEPATH "languagepath"
#define OPTION_SWPATH "swpath"
// core directory options
#define OPTION_CFG_DIRECTORY "cfg_directory"
@ -224,6 +225,7 @@ public:
const char *crosshair_path() const { return value(OPTION_CROSSHAIRPATH); }
const char *plugins_path() const { return value(OPTION_PLUGINSPATH); }
const char *language_path() const { return value(OPTION_LANGUAGEPATH); }
const char *sw_path() const { return value(OPTION_SWPATH); }
// core directory options
const char *cfg_directory() const { return value(OPTION_CFG_DIRECTORY); }

View File

@ -33,6 +33,7 @@ struct folders_entry
static const folders_entry s_folders[] =
{
{ __("ROMs"), OPTION_MEDIAPATH, ADDING },
{ __("Software Media"), OPTION_SWPATH, CHANGE },
{ __("UI"), OPTION_UI_PATH, CHANGE },
{ __("Language"), OPTION_LANGUAGEPATH, CHANGE },
{ __("Samples"), OPTION_SAMPLEPATH, ADDING },