Skip to content

Commit

Permalink
drop support for "single-file addons" (my_addon.cfg not with a dir)
Browse files Browse the repository at this point in the history
  • Loading branch information
cbeck88 committed Mar 15, 2015
1 parent eff4d0b commit 3f640b8
Showing 1 changed file with 1 addition and 25 deletions.
26 changes: 1 addition & 25 deletions src/game_config_manager.cpp
Expand Up @@ -335,39 +335,15 @@ void game_config_manager::load_addons_cfg()
const std::string file = uc;
const int size_minus_extension = file.size() - 4;
if(file.substr(size_minus_extension, file.size()) == ".cfg") {
bool ok = true;
// Allowing it if the dir doesn't exist,
// for the single-file add-on.
if(filesystem::file_exists(file.substr(0, size_minus_extension))) {
// Unfortunately, we create the dir plus
// _info.cfg ourselves on download.
std::vector<std::string> dirs, files;
filesystem::get_files_in_dir(file.substr(0, size_minus_extension),
&files, &dirs);
if(dirs.size() > 0) {
ok = false;
}
if(files.size() > 1) {
ok = false;
}
if(files.size() == 1 && files[0] != "_info.cfg") {
ok = false;
}
}
if(!ok) {
const int userdata_loc = file.find("data/add-ons") + 5;
ERR_CONFIG << "error reading usermade add-on '"
<< file << "'\n";
error_addons.push_back(file);
error_log.push_back("The format '~" + file.substr(userdata_loc)
+ "' is only for single-file add-ons, use '~"
+ "' (for single-file add-ons) is not supported anymore, use '~"
+ file.substr(userdata_loc,
size_minus_extension - userdata_loc)
+ "/_main.cfg' instead.");
}
else {
addons_to_load.push_back(file);
}
}
}

Expand Down

0 comments on commit 3f640b8

Please sign in to comment.