about summary refs log tree commit diff
path: root/src/engine
diff options
context:
space:
mode:
authorBatchyx <batchman@free.fr>2010-11-01 16:35:15 +0100
committeroy <Tom_Adams@web.de>2010-11-24 01:15:18 +0100
commitc3966413e9f9c612fb26cfb2d0a20d85aa136df9 (patch)
tree756761bb38ee9e41a264a53c746b5abd7833d670 /src/engine
parente6698b111873e5c8584343eb511aa40c7052f99b (diff)
downloadzcatch-c3966413e9f9c612fb26cfb2d0a20d85aa136df9.tar.gz
zcatch-c3966413e9f9c612fb26cfb2d0a20d85aa136df9.zip
Storage: fix RemoveFile and CreateFolder ret value
Removefile returns remove() and CreateFolder returns fs_makedir(),
but they returns 0 on success and non-zero on error. Fix that,
RemoveFile and CreateFolder should return true on success.
(they return false when the type argument is invalid).

note: bug has remained unoticed because noone uses CreateFolder, and the
user of RemoveFile (the demo browser's remove button) doesn't
check the return value.
Diffstat (limited to 'src/engine')
-rw-r--r--src/engine/shared/storage.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/engine/shared/storage.cpp b/src/engine/shared/storage.cpp
index ec43847f..e43cd539 100644
--- a/src/engine/shared/storage.cpp
+++ b/src/engine/shared/storage.cpp
@@ -280,7 +280,7 @@ public:
 			return false;
 
 		char aBuffer[MAX_PATH_LENGTH];
-		return remove(GetPath(Type, pFilename, aBuffer, sizeof(aBuffer)));
+		return !remove(GetPath(Type, pFilename, aBuffer, sizeof(aBuffer)));
 	}
 
 	virtual bool CreateFolder(const char *pFoldername, int Type)
@@ -289,7 +289,7 @@ public:
 			return false;
 
 		char aBuffer[MAX_PATH_LENGTH];
-		return fs_makedir(GetPath(Type, pFoldername, aBuffer, sizeof(aBuffer)));
+		return !fs_makedir(GetPath(Type, pFoldername, aBuffer, sizeof(aBuffer)));
 	}
 
 	static IStorage *Create(const char *pApplicationName, int NumArgs, const char **ppArguments)