Ticket #4014: path_match_v1.patch
File path_match_v1.patch, 1.9 KB (added by , 15 years ago) |
---|
-
engines/kyra/gui_v2.cpp
730 730 Common::String oldName = _vm->getSavegameFilename(*i); 731 731 Common::String newName = _vm->getSavegameFilename(*i-1); 732 732 _vm->_saveFileMan->renameSavefile(oldName.c_str(), newName.c_str()); 733 } 733 } 734 734 _saveMenu.menuNameId = _vm->gameFlags().isTalkie ? 9 : 17; 735 735 return 0; 736 736 } -
common/archive.cpp
242 242 243 243 } 244 244 245 namespace { 246 247 void setupPathMatch(const Common::String &pattern, StringList &out) { 248 Common::StringTokenizer tokenizer(pattern, "/"); 249 while (!tokenizer.empty()) 250 out.push_back(tokenizer.nextToken()); 251 } 252 253 bool pathMatch(const Common::String &name, const StringList &matchAgainst) { 254 StringList nameSubs; 255 setupPathMatch(name, nameSubs); 256 257 if (nameSubs.size() != matchAgainst.size()) 258 return false; 259 260 for (Common::StringList::const_iterator i = nameSubs.begin(), j = matchAgainst.begin(); i != nameSubs.end(); ++i, ++j) 261 if (!Common::matchString(i->c_str(), j->c_str())) 262 return false; 263 264 return true; 265 } 266 267 } // end of namespace 268 245 269 int FSDirectory::listMatchingMembers(ArchiveMemberList &list, const String &pattern) { 246 270 if (!_node.isDirectory()) 247 271 return 0; … … 255 279 String lowercasePattern(pattern); 256 280 lowercasePattern.toLowercase(); 257 281 282 StringList patternSubs; 283 setupPathMatch(lowercasePattern, patternSubs); 284 258 285 int matches = 0; 259 286 NodeCache::iterator it = _fileCache.begin(); 260 287 for ( ; it != _fileCache.end(); it++) { 261 if ( (*it)._key.matchString(lowercasePattern)) {288 if (pathMatch(it->_key, patternSubs)) { 262 289 list.push_back(FSDirectoryMemberPtr(new FSDirectoryMember((*it)._value))); 263 290 matches++; 264 291 }