From 72c905b98114736d9f425efc9074a73fddff2553 Mon Sep 17 00:00:00 2001 From: Don Honerbrink Date: Tue, 28 Jul 2015 10:18:41 -0500 Subject: [PATCH] Use subcollection include.txt file if a .merge file does not exist --- .../Source/Collection/CollectionInfoBuilder.cpp | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/RetroFE/Source/Collection/CollectionInfoBuilder.cpp b/RetroFE/Source/Collection/CollectionInfoBuilder.cpp index 26b8c78..435af9d 100644 --- a/RetroFE/Source/Collection/CollectionInfoBuilder.cpp +++ b/RetroFE/Source/Collection/CollectionInfoBuilder.cpp @@ -251,27 +251,36 @@ bool CollectionInfoBuilder::ImportDirectory(CollectionInfo *info, std::string me if(mergedCollectionName != "") { - includeFile = Utils::combinePath(Configuration::absolutePath, "collections", mergedCollectionName, info->name + ".merge"); + + std::string mergedFile = Utils::combinePath(Configuration::absolutePath, "collections", mergedCollectionName, info->name + ".merge"); + Logger::write(Logger::ZONE_INFO, "CollectionInfoBuilder", "Checking for \"" + mergedFile + "\""); (void)conf_.getProperty("collections." + mergedCollectionName + ".list.includeMissingItems", showMissing); - ImportBasicList(info, includeFile, includeFilter); + ImportBasicList(info, mergedFile, includeFilter); + } else { (void)conf_.getProperty("collections." + info->name + ".list.includeMissingItems", showMissing); + } + + // If no merged file exists, or it is empty, attempt to use the include and exclude from the subcollection + // If this not a merged collection, the size will be 0 anyways and the code below will still execute + if(includeFilter.size() == 0) + { + Logger::write(Logger::ZONE_INFO, "CollectionInfoBuilder", "Checking for \"" + includeFile + "\""); ImportBasicList(info, includeFile, includeFilter); ImportBasicList(info, excludeFile, excludeFilter); } - std::vector extensions; std::vector::iterator extensionsIt; info->extensionList(extensions); - Logger::write(Logger::ZONE_INFO, "CollectionInfoBuilder", "Checking for \"" + includeFile + "\""); dp = opendir(path.c_str()); + Logger::write(Logger::ZONE_INFO, "CollectionInfoBuilder", "Scanning directory \"" + path + "\""); if(dp == NULL) { Logger::write(Logger::ZONE_INFO, "CollectionInfoBuilder", "Could not read directory \"" + path + "\". Ignore if this is a menu.");