Ensure that local installations (also known as portable installations) are possible...
authorNathan Letwory <nathan@letworyinteractive.com>
Sat, 10 Jul 2010 11:09:26 +0000 (11:09 +0000)
committerNathan Letwory <nathan@letworyinteractive.com>
Sat, 10 Jul 2010 11:09:26 +0000 (11:09 +0000)
For user config and data files, first check the 'local' location (where the executable is located), and only then the actual user locations (whatever the convention for the OSes; $HOME, %APPDATA%, etc).

source/blender/blenlib/intern/path_util.c

index 772782e..3b8599f 100644 (file)
@@ -1064,13 +1064,14 @@ char *BLI_get_folder(int folder_id, char *subfolder)
        switch (folder_id) {
                case BLENDER_DATAFILES:         /* general case */
                        BLI_join_dirfile(search_path, "datafiles", subfolder);
-                       if (get_path_user(path, search_path, "BLENDER_USER_DATAFILES")) break;
                        if (get_path_local(path, search_path)) break;
+                       if (get_path_user(path, search_path, "BLENDER_USER_DATAFILES")) break;
                        if (get_path_system(path, search_path, "BLENDER_SYSTEM_DATAFILES")) break;
                        return NULL;
                        
-               case BLENDER_USER_DATAFILES:            
+               case BLENDER_USER_DATAFILES:
                        BLI_join_dirfile(search_path, "datafiles", subfolder);
+                       if (get_path_local(path, search_path)) break;
                        if (get_path_user(path, search_path, "BLENDER_USER_DATAFILES")) break;
                        return NULL;
                        
@@ -1081,13 +1082,14 @@ char *BLI_get_folder(int folder_id, char *subfolder)
                        
                case BLENDER_CONFIG:            /* general case */
                        BLI_join_dirfile(search_path, "config", subfolder);
-                       if (get_path_user(path, search_path, "BLENDER_USER_CONFIG")) break;
                        if (get_path_local(path, search_path)) break;
+                       if (get_path_user(path, search_path, "BLENDER_USER_CONFIG")) break;
                        if (get_path_system(path, search_path, "BLENDER_SYSTEM_CONFIG")) break;
                        return NULL;
                        
                case BLENDER_USER_CONFIG:
                        BLI_join_dirfile(search_path, "config", subfolder);
+                       if (get_path_local(path, search_path)) break;
                        if (get_path_user(path, search_path, "BLENDER_USER_CONFIG")) break;
                        return NULL;
                        
@@ -1098,13 +1100,14 @@ char *BLI_get_folder(int folder_id, char *subfolder)
                        
                case BLENDER_SCRIPTS:           /* general case */
                        BLI_join_dirfile(search_path, "scripts", subfolder);
-                       if (get_path_user(path, search_path, "BLENDER_USER_SCRIPTS")) break;            
                        if (get_path_local(path, search_path)) break;
+                       if (get_path_user(path, search_path, "BLENDER_USER_SCRIPTS")) break;            
                        if (get_path_system(path, search_path, "BLENDER_SYSTEM_SCRIPTS")) break;
                        return NULL;
                        
                case BLENDER_USER_SCRIPTS:
                        BLI_join_dirfile(search_path, "scripts", subfolder);
+                       if (get_path_local(path, search_path)) break;
                        if (get_path_user(path, search_path, "BLENDER_USER_SCRIPTS")) break;
                        return NULL;
                        
@@ -1121,7 +1124,6 @@ char *BLI_get_folder(int folder_id, char *subfolder)
                        
                case BLENDER_SYSTEM_PYTHON:
                        BLI_join_dirfile(search_path, "python", subfolder);
-                       
                        if (get_path_system(path, search_path, "BLENDER_SYSTEM_PYTHON")) break;
                        return NULL;
        }