Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTon Roosendaal <ton@blender.org>2004-12-16 17:40:25 +0300
committerTon Roosendaal <ton@blender.org>2004-12-16 17:40:25 +0300
commit1b4667b33f4937f3ae2ee1c4f0661d35b14cdffd (patch)
treeb15db342dfaba42e42e6d8d734f6111f92ab3075 /source/blender/blenlib/intern/fileops.c
parent6719d88aab15627bdbe05f7ac116addffd2e165f (diff)
Errors in saving runtime, and fileops in file window; files were copied
or deleted without keeping track of spaces in names, causing in potential loss of data. Needs review!
Diffstat (limited to 'source/blender/blenlib/intern/fileops.c')
-rw-r--r--source/blender/blenlib/intern/fileops.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/source/blender/blenlib/intern/fileops.c b/source/blender/blenlib/intern/fileops.c
index a0d071aa177..a743e552407 100644
--- a/source/blender/blenlib/intern/fileops.c
+++ b/source/blender/blenlib/intern/fileops.c
@@ -222,12 +222,19 @@ int BLI_rename(char *from, char *to) {
* */
static char str[MAXPATHLEN+12];
-int BLI_delete(char *file, int dir, int recursive) {
- if (recursive) sprintf(str, "/bin/rm -rf %s", file);
- else if (dir) sprintf(str, "/bin/rmdir \"%s\"", file);
- else sprintf(str, "/bin/rm -f \"%s\"", file);
+int BLI_delete(char *file, int dir, int recursive)
+{
+ if(strchr(file, '"')) {
+ printf("Error: not deleted file %s because of quote!\n", file);
+ }
+ else {
+ if (recursive) sprintf(str, "/bin/rm -rf \"%s\"", file);
+ else if (dir) sprintf(str, "/bin/rmdir \"%s\"", file);
+ else sprintf(str, "/bin/rm -f \"%s\"", file);
- return system(str);
+ return system(str);
+ }
+ return -1;
}
int BLI_touch(char *file)
@@ -242,19 +249,19 @@ int BLI_touch(char *file)
}
int BLI_move(char *file, char *to) {
- sprintf(str, "/bin/mv -f %s %s", file, to);
+ sprintf(str, "/bin/mv -f \"%s\" \"%s\"", file, to);
return system(str);
}
int BLI_copy_fileops(char *file, char *to) {
- sprintf(str, "/bin/cp -rf \"%s\" %s", file, to);
+ sprintf(str, "/bin/cp -rf \"%s\" \"%s\"", file, to);
return system(str);
}
int BLI_link(char *file, char *to) {
- sprintf(str, "/bin/ln -f %s %s", file, to);
+ sprintf(str, "/bin/ln -f \"%s\" \"%s\"", file, to);
return system(str);
}