From b85bad3d6981927ed2a93fa1e9b846faefa88bac Mon Sep 17 00:00:00 2001 From: driAn Date: Sun, 25 May 2008 10:55:58 +0000 Subject: [PATCH] fixed deletion of config files git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@2103 e016b1c5-ed68-44aa-a2f7-31cac88cffde --- source/src/command.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/source/src/command.cpp b/source/src/command.cpp index 97bdfcb8..9e544276 100644 --- a/source/src/command.cpp +++ b/source/src/command.cpp @@ -570,12 +570,15 @@ COMMAND(writecfg, ARG_NONE); bool deletecfg() { - if(!delfile("config/saved.cfg") || !delfile("config/init.cfg")) + string configs[] = { "config/saved.cfg", "config/init.cfg" }; + bool failure = false; + loopi(sizeof(configs)/sizeof(configs[0])) { - conoutf("could not delete the configuration"); - return false; + const char *file = findfile(path(configs[i], true), "wb"); + if(!file) continue; + if(!delfile(file)) failure = true; } - return true; + return !failure; } void identnames(vector &names, bool builtinonly)