From cbb9dfaab80ed52950a4ea4c1570370eddacfa64 Mon Sep 17 00:00:00 2001 From: Andrea Weikert Date: Sun, 26 Jul 2009 18:52:27 +0000 Subject: 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 :) --- source/blender/blenlib/BLI_storage_types.h | 1 - source/blender/blenlib/intern/fileops.c | 13 +++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'source/blender/blenlib') diff --git a/source/blender/blenlib/BLI_storage_types.h b/source/blender/blenlib/BLI_storage_types.h index cdc85d1be39..36d96f6075c 100644 --- a/source/blender/blenlib/BLI_storage_types.h +++ b/source/blender/blenlib/BLI_storage_types.h @@ -77,7 +77,6 @@ struct direntry{ #define SELECT 1 #define HIDDEN 1 #define FIRST 1 -#define ACTIVE 2 #define DESELECT 0 #define NOT_YET 0 #define VISIBLE 0 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); } -- cgit v1.2.3