diff options
author | Andrea Weikert <elubie@gmx.net> | 2009-07-26 22:52:27 +0400 |
---|---|---|
committer | Andrea Weikert <elubie@gmx.net> | 2009-07-26 22:52:27 +0400 |
commit | cbb9dfaab80ed52950a4ea4c1570370eddacfa64 (patch) | |
tree | 3df161c74b8d43634bfb032f2ada65d6496b3cad /source/blender/blenlib/intern | |
parent | 4741137fc9639a3902a0a7bbbebb7256841ac027 (diff) |
2.5 file browser
* operator for create new directory activated (IKEY)
* operator for rename (works on files and directories so far) (CTRL+LMB)
Note: fail to rename is rather quiet, no message popup, just doesn't rename if it can't.
So far checked that (On Windows Vista) rename fails on system directories, which I think acceptable.
Note: I removed the code that (silently) deletes file if I rename file to an existing one. Considered harmful :)
Diffstat (limited to 'source/blender/blenlib/intern')
-rw-r--r-- | source/blender/blenlib/intern/fileops.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/source/blender/blenlib/intern/fileops.c b/source/blender/blenlib/intern/fileops.c index 42fd75a543e..b9c0dd65ede 100644 --- a/source/blender/blenlib/intern/fileops.c +++ b/source/blender/blenlib/intern/fileops.c @@ -311,10 +311,10 @@ void BLI_recurdir_fileops(char *dirname) { int BLI_rename(char *from, char *to) { if (!BLI_exists(from)) return 0; - /* make sure the filenames are different (case insensitive) before removing */ - if (BLI_exists(to) && BLI_strcasecmp(from, to)) - if(BLI_delete(to, 0, 0)) return 1; - + /* refuse to rename if file already exists */ + if (BLI_exists(to)) + return 1; + return rename(from, to); } @@ -391,8 +391,9 @@ void BLI_recurdir_fileops(char *dirname) { int BLI_rename(char *from, char *to) { if (!BLI_exists(from)) return 0; - if (BLI_exists(to)) if(BLI_delete(to, 0, 0)) return 1; - + /* refuse to rename if file already exists */ + if (BLI_exists(to)) return 1; + return rename(from, to); } |