diff options
author | Andrea Weikert <elubie@gmx.net> | 2010-07-16 00:02:53 +0400 |
---|---|---|
committer | Andrea Weikert <elubie@gmx.net> | 2010-07-16 00:02:53 +0400 |
commit | 05fb497f75aef331aa708945af5feb69e5169e7b (patch) | |
tree | d9733b5827555f26cf397b0b1e2d50ad56a8e00d /source/blender/blenlib | |
parent | 7fc9eee08afe87f3f688e8b9e9442951d6a08590 (diff) |
== installation paths ==
remove deprecated python BLI_gethome_folder calls
Patch by Brecht, thanks a lot
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r-- | source/blender/blenlib/BLI_path_util.h | 25 | ||||
-rw-r--r-- | source/blender/blenlib/intern/path_util.c | 115 |
2 files changed, 0 insertions, 140 deletions
diff --git a/source/blender/blenlib/BLI_path_util.h b/source/blender/blenlib/BLI_path_util.h index 316b850805d..57e6d0b16d7 100644 --- a/source/blender/blenlib/BLI_path_util.h +++ b/source/blender/blenlib/BLI_path_util.h @@ -41,31 +41,6 @@ struct ListBase; struct direntry; char *BLI_gethome(void); -char *BLI_gethome_folder(char *folder_name, int flag); - -/* BLI_gethome_folder flag */ -#define BLI_GETHOME_LOCAL 1<<1 /* relative location for portable binaries */ -#define BLI_GETHOME_SYSTEM 1<<2 /* system location, or set from the BLENDERPATH env variable (UNIX only) */ -#define BLI_GETHOME_USER 1<<3 /* home folder ~/.blender */ -#define BLI_GETHOME_ALL (BLI_GETHOME_SYSTEM|BLI_GETHOME_LOCAL|BLI_GETHOME_USER) - - -#ifdef __APPLE__ -typedef enum { - BasePath_Temporary = 1, - BasePath_BlenderShared, - BasePath_BlenderUser, - BasePath_ApplicationBundle -} basePathesTypes; - -/** - * Gets the base path. The path may not exist. - * Note that return string must be copied as its persistence is not guaranteed - * - * @return base path of pathType - */ -const char* BLI_osx_getBasePath(basePathesTypes pathType); -#endif char *BLI_get_folder(int folder_id, char *subfolder); char *BLI_get_folder_create(int folder_id, char *subfolder); diff --git a/source/blender/blenlib/intern/path_util.c b/source/blender/blenlib/intern/path_util.c index c1e0059e954..6ab7ba2a7a5 100644 --- a/source/blender/blenlib/intern/path_util.c +++ b/source/blender/blenlib/intern/path_util.c @@ -795,121 +795,6 @@ char *BLI_gethome(void) { #endif } -/* this function returns the path to a blender folder, if it exists - * utility functions for BLI_gethome_folder */ - -// #define PATH_DEBUG /* for testing paths that are checked */ - -static int test_data_path(char *targetpath, char *path_base, char *path_sep, char *folder_name) -{ - char tmppath[FILE_MAXDIR]; - - if(path_sep) BLI_join_dirfile(tmppath, path_base, path_sep); - else BLI_strncpy(tmppath, path_base, sizeof(tmppath)); - - BLI_make_file_string("/", targetpath, tmppath, folder_name); - - if (BLI_is_dir(targetpath)) { -#ifdef PATH_DEBUG - printf("\tpath found: %s\n", targetpath); -#endif - return 1; - } - else { -#ifdef PATH_DEBUG - printf("\tpath missing: %s\n", targetpath); -#endif - targetpath[0] = '\0'; - return 0; - } -} - -static int gethome_path_local(char *targetpath, char *folder_name) -{ - extern char bprogname[]; /* argv[0] from creator.c */ - char bprogdir[FILE_MAXDIR]; - char cwd[FILE_MAXDIR]; - char *s; - int i; - -#ifdef PATH_DEBUG - printf("gethome_path_local...\n"); -#endif - - /* try release/folder_name (binary relative) */ - /* use argv[0] (bprogname) to get the path to the executable */ - s = BLI_last_slash(bprogname); - i = s - bprogname + 1; - BLI_strncpy(bprogdir, bprogname, i); - - /* try release/folder_name (BIN relative) */ - if(test_data_path(targetpath, bprogdir, "release", folder_name)) - return 1; - - /* try release/folder_name (CWD relative) */ - if(test_data_path(targetpath, BLI_getwdN(cwd), "release", folder_name)) - return 1; - - /* try ./.blender/folder_name */ - if(test_data_path(targetpath, bprogdir, ".blender", folder_name)) - return 1; - - return 0; -} - -static int gethome_path_user(char *targetpath, char *folder_name) -{ - char *home_path= BLI_gethome(); - -#ifdef PATH_DEBUG - printf("gethome_path_user...\n"); -#endif - - /* try $HOME/folder_name */ - return test_data_path(targetpath, home_path, ".blender", folder_name); -} - -static int gethome_path_system(char *targetpath, char *folder_name) -{ - extern char blender_path[]; /* unix prefix eg. /usr/share/blender/2.5 creator.c */ - - if(!blender_path[0]) - return 0; - -#ifdef PATH_DEBUG - printf("gethome_path_system...\n"); -#endif - - /* try $BLENDERPATH/folder_name */ - return test_data_path(targetpath, blender_path, NULL, folder_name); -} - -char *BLI_gethome_folder(char *folder_name, int flag) -{ - static char fulldir[FILE_MAXDIR] = ""; - - /* first check if this is a redistributable bundle */ - if(flag & BLI_GETHOME_LOCAL) { - if (gethome_path_local(fulldir, folder_name)) - return fulldir; - } - - /* then check if the OS has blender data files installed in a global location */ - if(flag & BLI_GETHOME_SYSTEM) { - if (gethome_path_system(fulldir, folder_name)) - return fulldir; - } - - /* now check the users home dir for data files */ - if(flag & BLI_GETHOME_USER) { - if (gethome_path_user(fulldir, folder_name)) - return fulldir; - } - - return NULL; -} - - /* NEW stuff, to be cleaned up when fully migrated */ /* ************************************************************* */ /* ************************************************************* */ |