Added temporary support for paths 'terrain/../' and 'dialogs/../'.

This commit is contained in:
Guillaume Melquiond 2009-03-03 17:44:51 +00:00
parent b9acfee589
commit 1341ebe448

View File

@ -994,6 +994,15 @@ std::string get_binary_file_location(const std::string& type, const std::string&
return std::string();
}
// Some parts of Wesnoth enjoy putting ".." inside filenames. This is
// bad and should be fixed. But in the meantime, deal with them in a dumb way.
std::string::size_type pos = filename.rfind("../");
if (pos != std::string::npos) {
std::string nf = filename.substr(pos + 3);
WRN_FS << "Illegal path '" << filename << "' replaced by '" << nf << "'\n";
return get_binary_file_location(type, nf);
}
if (filename.find("..") != std::string::npos) {
ERR_FS << "Illegal path '" << filename << "' (\"..\" not allowed).\n";
return std::string();