about summary refs log tree commit diff
path: root/src/base
diff options
context:
space:
mode:
authoroy <Tom_Adams@web.de>2010-12-08 00:09:18 +0100
committeroy <Tom_Adams@web.de>2010-12-08 00:09:18 +0100
commitd30dd9da8fce880a44e598a41710015d1f4733a3 (patch)
tree52d4bd56971ca8201c7c9405db6d2a9da371f449 /src/base
parentbd9850cae2d17b713e5795ed1e90d4cea1f165b8 (diff)
downloadzcatch-d30dd9da8fce880a44e598a41710015d1f4733a3.tar.gz
zcatch-d30dd9da8fce880a44e598a41710015d1f4733a3.zip
added Storage function to move/rename files by Batchyx
Diffstat (limited to 'src/base')
-rw-r--r--src/base/system.c7
-rw-r--r--src/base/system.h16
2 files changed, 23 insertions, 0 deletions
diff --git a/src/base/system.c b/src/base/system.c
index 9cc27836..6339991d 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_rename(const char *oldname, const char *newname)
+{
+	if(rename(oldname, newname) != 0)
+		return 1;
+	return 0;
+}
+
 void swap_endian(void *data, unsigned elem_size, unsigned num)
 {
 	char *src = (char*) data;
diff --git a/src/base/system.h b/src/base/system.h
index fb249588..c863a33f 100644
--- a/src/base/system.h
+++ b/src/base/system.h
@@ -996,6 +996,22 @@ int fs_chdir(const char *path);
 int fs_parent_dir(char *path);
 
 /*
+	Function: fs_rename
+		Renames the file or directory. If the paths differ the file will be moved.
+	
+	Parameters:
+		oldname - The actual name
+		newname - The new name
+
+	Returns:
+		Returns 0 on success, 1 on failure.
+
+	Remarks:
+		- The strings are treated as zero-terminated strings.
+*/
+int fs_rename(const char *oldname, const char *newname);
+
+/*
 	Group: Undocumented
 */