diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2011-10-22 02:33:41 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2011-10-22 02:33:41 +0400 |
commit | 88473fd49a4f5330f8f6a932b0c9eccf28aaa459 (patch) | |
tree | a9a34685c62847942a1c469b446feec712dd43d3 /source/blender/blenlib | |
parent | 932aa116df985d21114dcad8c2518f69f8a6a39e (diff) |
Code cleanup: remove BLI_exist, now there is only BLI_exists. One function just
called the other, they did the same thing.
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r-- | source/blender/blenlib/BLI_fileops.h | 9 | ||||
-rw-r--r-- | source/blender/blenlib/BLI_path_util.h | 15 | ||||
-rw-r--r-- | source/blender/blenlib/BLI_storage.h | 41 | ||||
-rw-r--r-- | source/blender/blenlib/intern/fileops.c | 4 | ||||
-rw-r--r-- | source/blender/blenlib/intern/path_util.c | 16 | ||||
-rw-r--r-- | source/blender/blenlib/intern/storage.c | 4 |
6 files changed, 31 insertions, 58 deletions
diff --git a/source/blender/blenlib/BLI_fileops.h b/source/blender/blenlib/BLI_fileops.h index 21d28ca3185..354931e306a 100644 --- a/source/blender/blenlib/BLI_fileops.h +++ b/source/blender/blenlib/BLI_fileops.h @@ -46,10 +46,6 @@ void BLI_recurdir_fileops(const char *dirname); int BLI_link(const char *file, const char *to); int BLI_is_writable(const char *filename); -/** - * @attention Do not confuse with BLI_exist - */ -int BLI_exists(const char *file); int BLI_copy_fileops(const char *file, const char *to); int BLI_rename(const char *from, const char *to); int BLI_gzip(const char *from, const char *to); @@ -58,11 +54,6 @@ int BLI_delete(const char *file, int dir, int recursive); int BLI_move(const char *file, const char *to); int BLI_touch(const char *file); -/* only for the sane unix world: direct calls to system functions :( */ -#ifndef WIN32 -void BLI_setCmdCallBack(int (*f)(char*)); -#endif - #ifdef __cplusplus } #endif diff --git a/source/blender/blenlib/BLI_path_util.h b/source/blender/blenlib/BLI_path_util.h index 56ecec042f2..82794e08fa0 100644 --- a/source/blender/blenlib/BLI_path_util.h +++ b/source/blender/blenlib/BLI_path_util.h @@ -65,10 +65,6 @@ char *BLI_get_folder_version(const int id, const int ver, const int do_check); #define BLENDER_SYSTEM_PLUGINS 54 #define BLENDER_SYSTEM_PYTHON 54 -#define BLENDER_TEMP 80 - -#define BLENDER_USERFOLDER(id) (id >= BLENDER_USER_CONFIG && id <= BLENDER_USER_PLUGINS) - /* for BLI_get_folder_version only */ #define BLENDER_RESOURCE_PATH_USER 0 #define BLENDER_RESOURCE_PATH_LOCAL 1 @@ -79,17 +75,6 @@ char *BLI_get_folder_version(const int id, const int ver, const int do_check); #define BLENDER_HISTORY_FILE "recent-files.txt" #ifdef WIN32 -#define BLENDER_USER_FORMAT "%s\\Blender Foundation\\Blender\\%s" -#define BLENDER_SYSTEM_FORMAT "%s\\Blender Foundation\\Blender\\%s" -#elif defined(__APPLE__) -#define BLENDER_USER_FORMAT "%s/Blender/%s" -#define BLENDER_SYSTEM_FORMAT "%s/Blender/%s" -#else -#define BLENDER_USER_FORMAT "%s/.blender/%s" -#define BLENDER_SYSTEM_FORMAT "%s/blender/%s" -#endif - -#ifdef WIN32 #define SEP '\\' #define ALTSEP '/' #else diff --git a/source/blender/blenlib/BLI_storage.h b/source/blender/blenlib/BLI_storage.h index 017f9877baf..13c78b711a8 100644 --- a/source/blender/blenlib/BLI_storage.h +++ b/source/blender/blenlib/BLI_storage.h @@ -33,46 +33,35 @@ * \ingroup bli */ -#ifdef WIN32 -/* for size_t, only needed on win32 for some reason */ +/* for size_t (needed on windows) */ #include <stddef.h> -#endif struct direntry; - -void BLI_adddirstrings(void); -void BLI_builddir(const char *dirname, const char *relname); -int BLI_compare(struct direntry *entry1, struct direntry *entry2); - size_t BLI_filesize(int file); size_t BLI_filepathsize(const char *path); double BLI_diskfree(const char *dir); char *BLI_getwdN(char *dir, const int maxncpy); unsigned int BLI_getdir(const char *dirname, struct direntry **filelist); -/** - * @attention Do not confuse with BLI_exists - */ -int BLI_exist(const char *name); -/** - * Read a file as ASCII lines. An empty list is - * returned if the file cannot be opened or read. - * - * @attention The returned list should be free'd with - * BLI_free_file_lines. - * - * @param name The name of the file to read. - * @retval A list of strings representing the file lines. - */ + /* test if file or directory exists */ +int BLI_exists(const char *name); + /* test if there is a directory at the specified path */ int BLI_is_dir(const char *file); -struct LinkNode *BLI_read_file_as_lines(const char *name); +/** + * Read a file as ASCII lines. An empty list is + * returned if the file cannot be opened or read. + * + * @attention The returned list should be free'd with + * BLI_free_file_lines. + * + * @param name The name of the file to read. + * @retval A list of strings representing the file lines. + */ - /** - * Free the list returned by BLI_read_file_as_lines. - */ +struct LinkNode *BLI_read_file_as_lines(const char *name); void BLI_free_file_lines(struct LinkNode *lines); /* Compare if one was last modified before the other */ diff --git a/source/blender/blenlib/intern/fileops.c b/source/blender/blenlib/intern/fileops.c index e848ad8d0d3..3a2efbd6feb 100644 --- a/source/blender/blenlib/intern/fileops.c +++ b/source/blender/blenlib/intern/fileops.c @@ -195,10 +195,6 @@ int BLI_touch(const char *file) return 0; } -int BLI_exists(const char *file) { - return BLI_exist(file); -} - #ifdef WIN32 static char str[MAXPATHLEN+12]; diff --git a/source/blender/blenlib/intern/path_util.c b/source/blender/blenlib/intern/path_util.c index f57ac09c9b9..91e813a0350 100644 --- a/source/blender/blenlib/intern/path_util.c +++ b/source/blender/blenlib/intern/path_util.c @@ -84,6 +84,18 @@ #endif /* WIN32 */ +/* standard paths */ +#ifdef WIN32 +#define BLENDER_USER_FORMAT "%s\\Blender Foundation\\Blender\\%s" +#define BLENDER_SYSTEM_FORMAT "%s\\Blender Foundation\\Blender\\%s" +#elif defined(__APPLE__) +#define BLENDER_USER_FORMAT "%s/Blender/%s" +#define BLENDER_SYSTEM_FORMAT "%s/Blender/%s" +#else +#define BLENDER_USER_FORMAT "%s/.blender/%s" +#define BLENDER_SYSTEM_FORMAT "%s/blender/%s" +#endif + /* local */ #define UNIQUE_NAME_MAX 128 @@ -1635,7 +1647,7 @@ static int add_win32_extension(char *name) int retval = 0; int type; - type = BLI_exist(name); + type = BLI_exists(name); if ((type == 0) || S_ISDIR(type)) { #ifdef _WIN32 char filename[FILE_MAXDIR+FILE_MAXFILE]; @@ -1655,7 +1667,7 @@ static int add_win32_extension(char *name) strcat(filename, extensions); } - type = BLI_exist(filename); + type = BLI_exists(filename); if (type && (! S_ISDIR(type))) { retval = 1; strcpy(name, filename); diff --git a/source/blender/blenlib/intern/storage.c b/source/blender/blenlib/intern/storage.c index 7638e95b4ec..8b383f5fd11 100644 --- a/source/blender/blenlib/intern/storage.c +++ b/source/blender/blenlib/intern/storage.c @@ -438,7 +438,7 @@ size_t BLI_filepathsize(const char *path) } -int BLI_exist(const char *name) +int BLI_exists(const char *name) { #if defined(WIN32) && !defined(__MINGW32__) struct _stat64i32 st; @@ -471,7 +471,7 @@ int BLI_exist(const char *name) /* would be better in fileops.c except that it needs stat.h so add here */ int BLI_is_dir(const char *file) { - return S_ISDIR(BLI_exist(file)); + return S_ISDIR(BLI_exists(file)); } LinkNode *BLI_read_file_as_lines(const char *name) |