From: Wouter V. <m97...@us...> - 2005-01-11 20:52:57
|
Update of /cvsroot/openmsx/openMSX/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29505/src Modified Files: CommandLineParser.cc Log Message: lookup original filename inside zip/gz for filetype detection Index: CommandLineParser.cc =================================================================== RCS file: /cvsroot/openmsx/openMSX/src/CommandLineParser.cc,v retrieving revision 1.127 retrieving revision 1.128 diff -u -d -r1.127 -r1.128 --- CommandLineParser.cc 9 Jan 2005 14:31:59 -0000 1.127 +++ CommandLineParser.cc 11 Jan 2005 20:52:45 -0000 1.128 @@ -155,24 +155,25 @@ bool CommandLineParser::parseFileName(const string& arg, list<string>& cmdLine) { - string::size_type begin = arg.find_last_of('.'); + string originalName(arg); + try { + std::cout << "DEBUG1 " << originalName << std::endl; + File file(arg); + originalName = file.getOriginalName(); + std::cout << "DEBUG2 " << originalName << std::endl; + } catch (FileException& e) { + // ignore + } + string::size_type begin = originalName.find_last_of('.'); if (begin != string::npos) { // there is an extension // TODO <filename>,<mappertype> is deprecated - string::size_type end = arg.find_last_of(','); + string::size_type end = originalName.find_last_of(','); string extension; if ((end == string::npos) || (end <= begin)) { - extension = arg.substr(begin + 1); + extension = originalName.substr(begin + 1); } else { - extension = arg.substr(begin + 1, end - begin - 1); - } - if (((extension == "gz") || (extension == "zip")) && - (begin != 0)) { - end = begin; - begin = arg.find_last_of('.', begin - 1); - if (begin != string::npos) { - extension = arg.substr(begin + 1, end - begin - 1); - } + extension = originalName.substr(begin + 1, end - begin - 1); } FileTypeMap::const_iterator it2 = fileTypeMap.find(extension); if (it2 != fileTypeMap.end()) { |