From 02d0084db9c5573b9d5fafd4eb10c87aab34df8d Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 3 Oct 2010 21:13:52 +0000 Subject: changes to path searching - don't search CWD/foldername anymore, only CWD/2.54/foldername, since this is the new default build systems use. - local source paths (./release/scripts) are now treated as system path, otherwise when this is used you cant test ~/.blender/2.54/scripts at the same time. --- source/blender/blenlib/intern/path_util.c | 43 +++++++++++++++++++++---------- 1 file changed, 29 insertions(+), 14 deletions(-) (limited to 'source/blender/blenlib/intern') diff --git a/source/blender/blenlib/intern/path_util.c b/source/blender/blenlib/intern/path_util.c index fd69b7233de..23972c64ee1 100644 --- a/source/blender/blenlib/intern/path_util.c +++ b/source/blender/blenlib/intern/path_util.c @@ -838,7 +838,6 @@ static int get_path_local(char *targetpath, char *folder_name, char *subfolder_n extern char bprogname[]; /* argv[0] from creator.c */ char bprogdir[FILE_MAX]; char relfolder[FILE_MAX]; - char cwd[FILE_MAX]; #ifdef PATH_DEBUG2 printf("get_path_local...\n"); @@ -853,19 +852,7 @@ static int get_path_local(char *targetpath, char *folder_name, char *subfolder_n /* use argv[0] (bprogname) to get the path to the executable */ BLI_split_dirfile(bprogname, bprogdir, NULL); - /* try EXECUTABLE_DIR/folder_name */ - if(test_path(targetpath, bprogdir, "", relfolder)) - return 1; - - /* try CWD/release/folder_name */ - if(test_path(targetpath, BLI_getwdN(cwd), "release", relfolder)) - return 1; - - /* try EXECUTABLE_DIR/release/folder_name */ - if(test_path(targetpath, bprogdir, "release", relfolder)) - return 1; - - /* try EXECUTABLE_DIR/2.5/folder_name - new default directory for local blender installed files */ + /* try EXECUTABLE_DIR/2.5x/folder_name - new default directory for local blender installed files */ if(test_path(targetpath, bprogdir, blender_version_decimal(), relfolder)) return 1; @@ -914,6 +901,34 @@ static int get_path_system(char *targetpath, char *folder_name, char *subfolder_ char system_path[FILE_MAX]; const char *system_base_path; + + /* first allow developer only overrides to the system path + * these are only used when running blender from source */ + extern char bprogname[]; /* argv[0] from creator.c */ + char cwd[FILE_MAX]; + char relfolder[FILE_MAX]; + char bprogdir[FILE_MAX]; + + /* use argv[0] (bprogname) to get the path to the executable */ + BLI_split_dirfile(bprogname, bprogdir, NULL); + + if (subfolder_name) { + BLI_join_dirfile(relfolder, folder_name, subfolder_name); + } else { + BLI_strncpy(relfolder, folder_name, FILE_MAX); + } + + /* try CWD/release/folder_name */ + if(test_path(targetpath, BLI_getwdN(cwd), "release", relfolder)) + return 1; + + /* try EXECUTABLE_DIR/release/folder_name */ + if(test_path(targetpath, bprogdir, "release", relfolder)) + return 1; + /* end developer overrides */ + + + system_path[0] = '\0'; if (test_env_path(system_path, envvar)) { -- cgit v1.2.3