diff options
| author | oy <Tom_Adams@web.de> | 2010-12-08 00:13:59 +0100 |
|---|---|---|
| committer | oy <Tom_Adams@web.de> | 2010-12-08 00:13:59 +0100 |
| commit | 7c26dcbadd710e2aa0b8a010ecb2c03b7be56caa (patch) | |
| tree | ffac91b268109ce535184830289c8b78cb55f6a4 | |
| parent | d30dd9da8fce880a44e598a41710015d1f4733a3 (diff) | |
| download | zcatch-7c26dcbadd710e2aa0b8a010ecb2c03b7be56caa.tar.gz zcatch-7c26dcbadd710e2aa0b8a010ecb2c03b7be56caa.zip | |
moved function to remove files
| -rw-r--r-- | src/base/system.c | 7 | ||||
| -rw-r--r-- | src/base/system.h | 15 | ||||
| -rw-r--r-- | src/engine/shared/storage.cpp | 3 |
3 files changed, 23 insertions, 2 deletions
diff --git a/src/base/system.c b/src/base/system.c index 6339991d..5799d972 100644 --- a/src/base/system.c +++ b/src/base/system.c @@ -1016,6 +1016,13 @@ int fs_parent_dir(char *path) return 1; } +int fs_remove(const char *filename) +{ + if(remove(filename) != 0) + return 1; + return 0; +} + int fs_rename(const char *oldname, const char *newname) { if(rename(oldname, newname) != 0) diff --git a/src/base/system.h b/src/base/system.h index c863a33f..39e7c994 100644 --- a/src/base/system.h +++ b/src/base/system.h @@ -996,6 +996,21 @@ int fs_chdir(const char *path); int fs_parent_dir(char *path); /* + Function: fs_remove + Deletes the file with the specified name. + + Parameters: + filename - The file to delete + + Returns: + Returns 0 on success, 1 on failure. + + Remarks: + - The strings are treated as zero-terminated strings. +*/ +int fs_remove(const char *filename); + +/* Function: fs_rename Renames the file or directory. If the paths differ the file will be moved. diff --git a/src/engine/shared/storage.cpp b/src/engine/shared/storage.cpp index eaddf0ba..9349b7d2 100644 --- a/src/engine/shared/storage.cpp +++ b/src/engine/shared/storage.cpp @@ -1,6 +1,5 @@ /* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */ /* If you are missing that file, acquire a complete release at teeworlds.com. */ -#include <stdio.h> //remove() #include <base/system.h> #include <engine/storage.h> #include "engine.h" @@ -280,7 +279,7 @@ public: return false; char aBuffer[MAX_PATH_LENGTH]; - return !remove(GetPath(Type, pFilename, aBuffer, sizeof(aBuffer))); + return !fs_remove(GetPath(Type, pFilename, aBuffer, sizeof(aBuffer))); } virtual bool RenameFile(const char* pOldFilename, const char* pNewFilename, int Type) |