mirror of
https://github.com/FunKey-Project/RetroFE.git
synced 2026-04-02 18:25:30 +02:00
Removed documentation (use retrofe.com/wiki) instead.
This commit is contained in:
@@ -64,86 +64,86 @@ bool CollectionInfoBuilder::CreateCollectionDirectory(std::string name)
|
||||
paths.push_back(collectionPath + "/roms");
|
||||
paths.push_back(collectionPath + "/system_artwork");
|
||||
|
||||
for(std::vector<std::string>::iterator it = paths.begin(); it != paths.end(); it++)
|
||||
{
|
||||
std::cout << "Creating folder \"" << *it << "\"" << std::endl;
|
||||
|
||||
#if defined(_WIN32)
|
||||
if(!CreateDirectory(it->c_str(), NULL))
|
||||
{
|
||||
if(ERROR_ALREADY_EXISTS != GetLastError())
|
||||
{
|
||||
std::cout << "Could not create folder \"" << *it << "\"" << std::endl;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
#else
|
||||
if(mkdir(it->c_str(), 0644) == -1)
|
||||
{
|
||||
std::cout << "Could not create folder \"" << *it << "\":" << strerror(errno) << std::endl;
|
||||
}
|
||||
for(std::vector<std::string>::iterator it = paths.begin(); it != paths.end(); it++)
|
||||
{
|
||||
std::cout << "Creating folder \"" << *it << "\"" << std::endl;
|
||||
|
||||
#if defined(_WIN32)
|
||||
if(!CreateDirectory(it->c_str(), NULL))
|
||||
{
|
||||
if(ERROR_ALREADY_EXISTS != GetLastError())
|
||||
{
|
||||
std::cout << "Could not create folder \"" << *it << "\"" << std::endl;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
#else
|
||||
if(mkdir(it->c_str(), 0644) == -1)
|
||||
{
|
||||
std::cout << "Could not create folder \"" << *it << "\":" << strerror(errno) << std::endl;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
std::string filename = collectionPath + "/include.txt";
|
||||
std::cout << "Creating file \"" << filename << "\"" << std::endl;
|
||||
|
||||
std::ofstream includeFile;
|
||||
includeFile.open(filename.c_str());
|
||||
includeFile << "# Add a list of files to show on the menu (one filename per line, without the extension)." << std::endl;
|
||||
includeFile << "# If no items are in this list then all files in the folder specified" << std::endl;
|
||||
includeFile << "# by settings.conf will be used" << std::endl;
|
||||
includeFile.close();
|
||||
|
||||
filename = collectionPath + "/exclude.txt";
|
||||
std::cout << "Creating file \"" << filename << "\"" << std::endl;
|
||||
std::ofstream excludeFile;
|
||||
excludeFile.open(filename.c_str());
|
||||
|
||||
includeFile << "# Add a list of files to hide on the menu (one filename per line, without the extension)." << std::endl;
|
||||
excludeFile.close();
|
||||
|
||||
filename = collectionPath + "/settings.conf";
|
||||
std::cout << "Creating file \"" << filename << "\"" << std::endl;
|
||||
std::ofstream settingsFile;
|
||||
settingsFile.open(filename.c_str());
|
||||
|
||||
settingsFile << "# Uncomment and edit the following line to use a different ROM path." << std::endl;
|
||||
settingsFile << "#list.path = %BASE_ITEM_PATH%/%ITEM_COLLECTION_NAME%/roms" << std::endl;
|
||||
settingsFile << "list.extensions = zip" << std::endl;
|
||||
settingsFile << "launcher = mame" << std::endl;
|
||||
settingsFile << "metadata.type = MAME" << std::endl;
|
||||
settingsFile << std::endl;
|
||||
settingsFile << "#media.screenshot = %BASE_MEDIA_PATH%/%ITEM_COLLECTION_NAME%/medium_artwork/screenshot" << std::endl;
|
||||
settingsFile << "#media.screentitle = %BASE_MEDIA_PATH%/%ITEM_COLLECTION_NAME%/medium_artwork/screentitle" << std::endl;
|
||||
settingsFile << "#media.artwork_back = %BASE_MEDIA_PATH%/%ITEM_COLLECTION_NAME%/medium_artwork/artwork_back" << std::endl;
|
||||
settingsFile << "#media.artwork_front = %BASE_MEDIA_PATH%/%ITEM_COLLECTION_NAME%/medium_artwork/artwork_front" << std::endl;
|
||||
settingsFile << "#media.logo = %BASE_MEDIA_PATH%/%ITEM_COLLECTION_NAME%/medium_artwork/logo" << std::endl;
|
||||
settingsFile << "#media.medium_back = %BASE_MEDIA_PATH%/%ITEM_COLLECTION_NAME%/medium_artwork/medium_back" << std::endl;
|
||||
settingsFile << "#media.medium_front = %BASE_MEDIA_PATH%/%ITEM_COLLECTION_NAME%/medium_artwork/medium_front" << std::endl;
|
||||
settingsFile << "#media.screenshot = %BASE_MEDIA_PATH%/%ITEM_COLLECTION_NAME%/medium_artwork/screenshot" << std::endl;
|
||||
settingsFile << "#media.screentitle = %BASE_MEDIA_PATH%/%ITEM_COLLECTION_NAME%/medium_artwork/screentitle" << std::endl;
|
||||
settingsFile << "#media.video = %BASE_MEDIA_PATH%/%ITEM_COLLECTION_NAME%/medium_artwork/video" << std::endl;
|
||||
settingsFile.close();
|
||||
|
||||
filename = collectionPath + "/menu.xml";
|
||||
std::cout << "Creating file \"" << filename << "\"" << std::endl;
|
||||
std::ofstream menuFile;
|
||||
menuFile.open(filename.c_str());
|
||||
|
||||
menuFile << "<menu>" << std::endl;
|
||||
menuFile << std::endl;
|
||||
menuFile << "<!-- uncomment this line and edit the example below to have a submenu" << std::endl;
|
||||
menuFile << std::endl;
|
||||
menuFile << " <item collection=\"Some collection name\"/>" << std::endl;
|
||||
menuFile << " <item collection=\"Arcade\"/>" << std::endl;
|
||||
menuFile << std::endl;
|
||||
menuFile << "uncomment this line and edit the example above to have a submenu -->" << std::endl;
|
||||
menuFile << std::endl;
|
||||
menuFile << "</menu>" << std::endl;
|
||||
menuFile.close();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string filename = collectionPath + "/include.txt";
|
||||
std::cout << "Creating file \"" << filename << "\"" << std::endl;
|
||||
|
||||
std::ofstream includeFile;
|
||||
includeFile.open(filename.c_str());
|
||||
includeFile << "# Add a list of files to show on the menu (one filename per line, without the extension)." << std::endl;
|
||||
includeFile << "# If no items are in this list then all files in the folder specified" << std::endl;
|
||||
includeFile << "# by settings.conf will be used" << std::endl;
|
||||
includeFile.close();
|
||||
|
||||
filename = collectionPath + "/exclude.txt";
|
||||
std::cout << "Creating file \"" << filename << "\"" << std::endl;
|
||||
std::ofstream excludeFile;
|
||||
excludeFile.open(filename.c_str());
|
||||
|
||||
includeFile << "# Add a list of files to hide on the menu (one filename per line, without the extension)." << std::endl;
|
||||
excludeFile.close();
|
||||
|
||||
filename = collectionPath + "/settings.conf";
|
||||
std::cout << "Creating file \"" << filename << "\"" << std::endl;
|
||||
std::ofstream settingsFile;
|
||||
settingsFile.open(filename.c_str());
|
||||
|
||||
settingsFile << "# Uncomment and edit the following line to use a different ROM path." << std::endl;
|
||||
settingsFile << "#list.path = %BASE_ITEM_PATH%/%ITEM_COLLECTION_NAME%/roms" << std::endl;
|
||||
settingsFile << "list.extensions = zip" << std::endl;
|
||||
settingsFile << "launcher = mame" << std::endl;
|
||||
settingsFile << "metadata.type = MAME" << std::endl;
|
||||
settingsFile << std::endl;
|
||||
settingsFile << "#media.screenshot = %BASE_MEDIA_PATH%/%ITEM_COLLECTION_NAME%/medium_artwork/screenshot" << std::endl;
|
||||
settingsFile << "#media.screentitle = %BASE_MEDIA_PATH%/%ITEM_COLLECTION_NAME%/medium_artwork/screentitle" << std::endl;
|
||||
settingsFile << "#media.artwork_back = %BASE_MEDIA_PATH%/%ITEM_COLLECTION_NAME%/medium_artwork/artwork_back" << std::endl;
|
||||
settingsFile << "#media.artwork_front = %BASE_MEDIA_PATH%/%ITEM_COLLECTION_NAME%/medium_artwork/artwork_front" << std::endl;
|
||||
settingsFile << "#media.logo = %BASE_MEDIA_PATH%/%ITEM_COLLECTION_NAME%/medium_artwork/logo" << std::endl;
|
||||
settingsFile << "#media.medium_back = %BASE_MEDIA_PATH%/%ITEM_COLLECTION_NAME%/medium_artwork/medium_back" << std::endl;
|
||||
settingsFile << "#media.medium_front = %BASE_MEDIA_PATH%/%ITEM_COLLECTION_NAME%/medium_artwork/medium_front" << std::endl;
|
||||
settingsFile << "#media.screenshot = %BASE_MEDIA_PATH%/%ITEM_COLLECTION_NAME%/medium_artwork/screenshot" << std::endl;
|
||||
settingsFile << "#media.screentitle = %BASE_MEDIA_PATH%/%ITEM_COLLECTION_NAME%/medium_artwork/screentitle" << std::endl;
|
||||
settingsFile << "#media.video = %BASE_MEDIA_PATH%/%ITEM_COLLECTION_NAME%/medium_artwork/video" << std::endl;
|
||||
settingsFile.close();
|
||||
|
||||
filename = collectionPath + "/menu.xml";
|
||||
std::cout << "Creating file \"" << filename << "\"" << std::endl;
|
||||
std::ofstream menuFile;
|
||||
menuFile.open(filename.c_str());
|
||||
|
||||
menuFile << "<menu>" << std::endl;
|
||||
menuFile << std::endl;
|
||||
menuFile << "<!-- uncomment this line and edit the example below to have a submenu" << std::endl;
|
||||
menuFile << std::endl;
|
||||
menuFile << " <item collection=\"Some collection name\"/>" << std::endl;
|
||||
menuFile << " <item collection=\"Arcade\"/>" << std::endl;
|
||||
menuFile << std::endl;
|
||||
menuFile << "uncomment this line and edit the example above to have a submenu -->" << std::endl;
|
||||
menuFile << std::endl;
|
||||
menuFile << "</menu>" << std::endl;
|
||||
menuFile.close();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
CollectionInfo *CollectionInfoBuilder::BuildCollection(std::string name)
|
||||
@@ -256,10 +256,13 @@ bool CollectionInfoBuilder::ImportDirectory(CollectionInfo *info)
|
||||
Utils::NormalizeBackSlashes(file);
|
||||
size_t position = file.find_last_of(".");
|
||||
std::string basename = (std::string::npos == position)? file : file.substr(0, position);
|
||||
|
||||
|
||||
// if there is an include list, only include roms that are found and are in the include list
|
||||
// if there is an exclude list, exclude those roms
|
||||
if((includeFilter.size() == 0 || includeFilter.find(basename) != includeFilter.end()) &&
|
||||
(excludeFilter.size() == 0 || excludeFilter.find(basename) == excludeFilter.end()))
|
||||
{
|
||||
// iterate through all known file extensions
|
||||
for(extensionsIt = extensions.begin(); extensionsIt != extensions.end(); ++extensionsIt)
|
||||
{
|
||||
std::string comparator = "." + *extensionsIt;
|
||||
|
||||
Reference in New Issue
Block a user