InspectionMatch Tool::inspectInput(const Common::Filename &filename) { for (ToolInputs::iterator iter = _inputPaths.begin(); iter != _inputPaths.end(); ++iter) { std::string p = iter->format; if (p == "/") { // TODO // Directory, we don't handle this yet, don't display at all return IMATCH_AWFUL; } Common::Filename cmp_filename = p; if (cmp_filename.getName() == "*") { if (cmp_filename.getExtension() == "*") // Match anything! return IMATCH_POSSIBLE; else if (scumm_stricmp(cmp_filename.getExtension().c_str(), filename.getExtension().c_str()) == 0) // Extensions are the same return IMATCH_PERFECT; } else { // Match on filename if (cmp_filename.getName() == filename.getName()) { if (cmp_filename.getExtension() == "*") return IMATCH_PERFECT; else if (scumm_stricmp(cmp_filename.getExtension().c_str(), filename.getExtension().c_str()) == 0) // Filenames are identical return IMATCH_PERFECT; } } } // Didn't match any of our inputs return IMATCH_AWFUL; }
InspectionMatch Tool::inspectInput(const Common::Filename &filename, const std::string& format) { // Case were we expect a directory if (format == "/") { if (filename.directory()) return IMATCH_POSSIBLE; return IMATCH_AWFUL; } // We expect a file. // First check this is not a directory. if (filename.directory()) return IMATCH_AWFUL; Common::Filename cmp_filename = format; if (cmp_filename.getName() == "*") { if (cmp_filename.getExtension() == "*") // Match anything! return IMATCH_POSSIBLE; else if (scumm_stricmp(cmp_filename.getExtension().c_str(), filename.getExtension().c_str()) == 0) // Extensions are the same return IMATCH_PERFECT; } else { // Match on filename if (cmp_filename.getName() == filename.getName()) { if (cmp_filename.getExtension() == "*") return IMATCH_PERFECT; else if (scumm_stricmp(cmp_filename.getExtension().c_str(), filename.getExtension().c_str()) == 0) // Filenames are identical return IMATCH_PERFECT; } } return IMATCH_AWFUL; }