Solve the multiple-inclusion problem.

This commit is contained in:
Eric S. Raymond 2007-05-19 01:54:24 +00:00
parent 938562f3e7
commit 267a33438b
2 changed files with 20 additions and 13 deletions

View file

@ -422,26 +422,33 @@ void get_files_in_dir(const std::string& directory,
#endif /* __AMIGAOS4__ */
struct stat st;
if (reorder == DO_REORDER &&
::stat((fullname+"/"+MAINCFG).c_str(), &st)!=-1 &&
S_ISREG(st.st_mode)) {
if (files != NULL) {
if (mode == ENTIRE_FILE_PATH)
files->push_back(fullname + "/" + MAINCFG);
else
files->push_back(std::string(basename) + "/" + MAINCFG);
}
}
else if (::stat(fullname.c_str(), &st) != -1) {
if (::stat(fullname.c_str(), &st) != -1) {
if (S_ISREG(st.st_mode)) {
if (reorder == DO_REORDER && strcmp(basename, MAINCFG)==0) {
if (files != NULL)
files->clear();
if (dirs != NULL)
dirs->clear();
}
if (files != NULL) {
if (mode == ENTIRE_FILE_PATH)
files->push_back(fullname);
else
files->push_back(basename);
}
if (reorder == DO_REORDER && basename == MAINCFG)
break;
} else if (S_ISDIR(st.st_mode)) {
if (dirs != NULL) {
if (reorder == DO_REORDER &&
::stat((fullname+"/"+MAINCFG).c_str(), &st)!=-1 &&
S_ISREG(st.st_mode)) {
if (files != NULL) {
if (mode == ENTIRE_FILE_PATH)
files->push_back(fullname + "/" + MAINCFG);
else
files->push_back(std::string(basename) + "/" + MAINCFG);
}
} else if (dirs != NULL) {
if (mode == ENTIRE_FILE_PATH)
dirs->push_back(fullname);
else

View file

@ -1380,7 +1380,7 @@ void game_controller::read_game_cfg(const preproc_map& defines, config& cfg, boo
if(is_valid) {
const std::string& cache = get_cache_dir();
if(cache != "") {
const std::string fname = cache + "/game.cfg-cache" + str.str();
const std::string fname = cache + "/_main.cfg-cache" + str.str();
const std::string fname_checksum = fname + ".checksum";
file_tree_checksum dir_checksum;