mirror of
https://github.com/FunKey-Project/RetroFE.git
synced 2025-12-13 10:18:53 +01:00
Added support for collection's info.conf file in addition to the settings.conf. This file should be used to provide additional system information, and will overwrite similar settings in settings.conf. This feature is merely intended to allow a user to keep the settings separated from the system information.
This commit is contained in:
parent
46200f029d
commit
d3d4bdcd41
@ -121,9 +121,6 @@ bool CollectionInfoBuilder::createCollectionDirectory(std::string name)
|
|||||||
settingsFile << "launcher = mame" << std::endl;
|
settingsFile << "launcher = mame" << std::endl;
|
||||||
settingsFile << "#metadata.type = MAME" << std::endl;
|
settingsFile << "#metadata.type = MAME" << std::endl;
|
||||||
settingsFile << std::endl;
|
settingsFile << std::endl;
|
||||||
settingsFile << "#manufacturer = " << std::endl;
|
|
||||||
settingsFile << "#year = " << std::endl;
|
|
||||||
settingsFile << "#genre = " << std::endl;
|
|
||||||
settingsFile << std::endl;
|
settingsFile << std::endl;
|
||||||
settingsFile << "#media.screenshot = " << Utils::combinePath("%BASE_MEDIA_PATH%", "%ITEM_COLLECTION_NAME%", "medium_artwork", "screenshot") << std::endl;
|
settingsFile << "#media.screenshot = " << Utils::combinePath("%BASE_MEDIA_PATH%", "%ITEM_COLLECTION_NAME%", "medium_artwork", "screenshot") << std::endl;
|
||||||
settingsFile << "#media.screentitle = " << Utils::combinePath("%BASE_MEDIA_PATH%", "%ITEM_COLLECTION_NAME%", "medium_artwork", "screentitle") << std::endl;
|
settingsFile << "#media.screentitle = " << Utils::combinePath("%BASE_MEDIA_PATH%", "%ITEM_COLLECTION_NAME%", "medium_artwork", "screentitle") << std::endl;
|
||||||
|
|||||||
@ -74,7 +74,7 @@ bool Configuration::import(std::string keyPrefix, std::string file)
|
|||||||
return import("", keyPrefix, file);
|
return import("", keyPrefix, file);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Configuration::import(std::string collection, std::string keyPrefix, std::string file)
|
bool Configuration::import(std::string collection, std::string keyPrefix, std::string file, bool mustExist)
|
||||||
{
|
{
|
||||||
bool retVal = true;
|
bool retVal = true;
|
||||||
int lineCount = 0;
|
int lineCount = 0;
|
||||||
@ -86,7 +86,14 @@ bool Configuration::import(std::string collection, std::string keyPrefix, std::s
|
|||||||
|
|
||||||
if (!ifs.is_open())
|
if (!ifs.is_open())
|
||||||
{
|
{
|
||||||
Logger::write(Logger::ZONE_ERROR, "Configuration", "Could not open " + file + "\"");
|
if (mustExist)
|
||||||
|
{
|
||||||
|
Logger::write(Logger::ZONE_ERROR, "Configuration", "Could not open " + file + "\"");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Logger::write(Logger::ZONE_INFO, "Configuration", "Could not open " + file + "\"");
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -28,7 +28,7 @@ public:
|
|||||||
static std::string convertToAbsolutePath(std::string prefix, std::string path);
|
static std::string convertToAbsolutePath(std::string prefix, std::string path);
|
||||||
// gets the global configuration
|
// gets the global configuration
|
||||||
bool import(std::string keyPrefix, std::string file);
|
bool import(std::string keyPrefix, std::string file);
|
||||||
bool import(std::string collection, std::string keyPrefix, std::string file);
|
bool import(std::string collection, std::string keyPrefix, std::string file, bool mustExist = true);
|
||||||
bool getProperty(std::string key, std::string &value);
|
bool getProperty(std::string key, std::string &value);
|
||||||
bool getProperty(std::string key, int &value);
|
bool getProperty(std::string key, int &value);
|
||||||
bool getProperty(std::string key, bool &value);
|
bool getProperty(std::string key, bool &value);
|
||||||
|
|||||||
@ -146,6 +146,10 @@ bool ImportConfiguration(Configuration *c)
|
|||||||
{
|
{
|
||||||
std::string prefix = "collections." + collection;
|
std::string prefix = "collections." + collection;
|
||||||
|
|
||||||
|
std::string infoFile = Utils::combinePath(collectionsPath, collection, "info.conf");
|
||||||
|
|
||||||
|
c->import(collection, prefix, infoFile, false);
|
||||||
|
|
||||||
std::string settingsFile = Utils::combinePath(collectionsPath, collection, "settings.conf");
|
std::string settingsFile = Utils::combinePath(collectionsPath, collection, "settings.conf");
|
||||||
|
|
||||||
if(!c->import(collection, prefix, settingsFile))
|
if(!c->import(collection, prefix, settingsFile))
|
||||||
@ -154,6 +158,7 @@ bool ImportConfiguration(Configuration *c)
|
|||||||
closedir(dp);
|
closedir(dp);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user