@@ -28,10 +28,10 @@ namespace OpenXcom
2828namespace FileMap
2929{
3030
31- static std::vector< std::vector<std::string> > _rulesets;
32- static std::map<std::string, std::string> _resources;
31+ static std::vector<std::pair<std::string, std::vector<std::string> > > _rulesets;
32+ static std::map<std::string, std::string> _resources;
3333static std::map< std::string, std::set<std::string> > _vdirs;
34- static std::set<std::string> _emptySet;
34+ static std::set<std::string> _emptySet;
3535
3636static std::string _canonicalize (const std::string &in)
3737{
@@ -91,7 +91,7 @@ std::set<std::string> _filterFiles(const T &files, const std::string &ext)
9191std::set<std::string> filterFiles (const std::vector<std::string> &files, const std::string &ext) { return _filterFiles (files, ext); }
9292std::set<std::string> filterFiles (const std::set<std::string> &files, const std::string &ext) { return _filterFiles (files, ext); }
9393
94- const std::vector< std::vector<std::string> > &getRulesets ()
94+ const std::vector<std::pair<std::string, std::vector<std::string> > > &getRulesets ()
9595{
9696 return _rulesets;
9797}
@@ -107,20 +107,21 @@ static std::string _combinePath(const std::string &prefixPath, const std::string
107107 return ret;
108108}
109109
110- static void _mapFiles (const std::string &basePath, const std::string &relPath, bool ignoreRulesets)
110+ static void _mapFiles (const std::string &modId, const std::string &basePath,
111+ const std::string &relPath, bool ignoreRulesets)
111112{
112113 std::string fullDir = basePath + (relPath.length () ? " /" + relPath : " " );
113114 std::vector<std::string> files = CrossPlatform::getFolderContents (fullDir);
114115 std::set<std::string> rulesetFiles = _filterFiles (files, " rul" );
115116
116117 if (!ignoreRulesets && rulesetFiles.size ())
117118 {
118- _rulesets.insert (_rulesets.begin (), std::vector<std::string>( ));
119+ _rulesets.insert (_rulesets.begin (), std::pair<std::string, std:: vector<std::string> >(modId, std::vector<std::string>() ));
119120 for (std::set<std::string>::iterator i = rulesetFiles.begin (); i != rulesetFiles.end (); ++i)
120121 {
121122 std::string fullpath = fullDir + " /" + *i;
122123 Log (LOG_DEBUG ) << " recording ruleset: " << fullpath;
123- _rulesets.front ().push_back (fullpath);
124+ _rulesets.front ().second . push_back (fullpath);
124125 }
125126 }
126127
@@ -143,7 +144,7 @@ static void _mapFiles(const std::string &basePath, const std::string &relPath, b
143144 // record ruleset files in that subdirectory, otherwise ignore them
144145 bool ignoreRulesetsRecurse =
145146 !rulesetFiles.empty () || !relPath.empty () || _canonicalize (*i) != " ruleset" ;
146- _mapFiles (basePath, _combinePath (relPath, *i), ignoreRulesetsRecurse);
147+ _mapFiles (modId, basePath, _combinePath (relPath, *i), ignoreRulesetsRecurse);
147148 continue ;
148149 }
149150
@@ -179,10 +180,10 @@ void clear()
179180 _vdirs.clear ();
180181}
181182
182- void load (const std::string &path, bool ignoreRulesets)
183+ void load (const std::string &modId, const std::string & path, bool ignoreRulesets)
183184{
184185 Log (LOG_INFO ) << " mapping resources in: " << path;
185- _mapFiles (path, " " , ignoreRulesets);
186+ _mapFiles (modId, path, " " , ignoreRulesets);
186187}
187188
188189}
0 commit comments