From c3966413e9f9c612fb26cfb2d0a20d85aa136df9 Mon Sep 17 00:00:00 2001 From: Batchyx Date: Mon, 1 Nov 2010 16:35:15 +0100 Subject: 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. --- src/engine/shared/storage.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/engine/shared/storage.cpp') 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) -- cgit 1.4.1