more robust config reset

git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@2784 e016b1c5-ed68-44aa-a2f7-31cac88cffde
This commit is contained in:
driAn
2008-09-28 11:42:31 +00:00
parent 49826cc172
commit 7f42db0d0b
2 changed files with 9 additions and 8 deletions
+8 -7
View File
@@ -762,17 +762,18 @@ void writecfg()
COMMAND(writecfg, ARG_NONE);
bool deletecfg()
void deletecfg()
{
string configs[] = { "config/saved.cfg", "config/init.cfg" };
bool failure = false;
loopi(sizeof(configs)/sizeof(configs[0]))
loopj(2) // delete files in homedir and basedir if possible
{
const char *file = findfile(path(configs[i], true), "wb");
if(!file) continue;
if(!delfile(file)) failure = true;
loopi(sizeof(configs)/sizeof(configs[0]))
{
const char *file = findfile(path(configs[i], true), "r");
if(!file) continue;
delfile(file);
}
}
return !failure;
}
void identnames(vector<const char *> &names, bool builtinonly)