blob: 398ccc5e9a9104d692baefdaf9436779fc06cce3 [file] [log] [blame]
--- blender-2.44/source/blender/python/api2_2x/EXPP_interface.c.orig 2006-05-01 14:24:56.000000000 +0200
+++ blender-2.44/source/blender/python/api2_2x/EXPP_interface.c 2007-06-21 22:25:39.000000000 +0200
@@ -52,85 +52,13 @@
*/
char *bpy_gethome(int append_scriptsdir)
{
- static char homedir[FILE_MAXDIR];
- static char scriptsdir[FILE_MAXDIR];
- char tmpdir[FILE_MAXDIR];
- char bprogdir[FILE_MAXDIR];
- char *s;
- int i;
+ static char homedir[FILE_MAXDIR]="/usr/share/blender";
+ static char scriptsdir[FILE_MAXDIR]="/usr/share/blender/scripts";
if (append_scriptsdir) {
- if (scriptsdir[0] != '\0')
return scriptsdir;
}
- else if (homedir[0] != '\0')
- return homedir;
-
- /* BLI_gethome() can return NULL if env vars are not set */
- s = BLI_gethome();
-
- if( !s ) /* bail if no $HOME */
- {
- printf("$HOME is NOT set\n");
- return NULL;
- }
-
- if( strstr( s, ".blender" ) )
- PyOS_snprintf( homedir, FILE_MAXDIR, s );
- else
- BLI_make_file_string( "/", homedir, s, ".blender" );
-
- /* if userhome/.blender/ exists, return it */
- if( BLI_exists( homedir ) ) {
- if (append_scriptsdir) {
- BLI_make_file_string("/", scriptsdir, homedir, "scripts");
- if (BLI_exists (scriptsdir)) return scriptsdir;
- }
- else return homedir;
- }
- else homedir[0] = '\0';
-
- /* if either:
- * no homedir was found or
- * append_scriptsdir = 1 but there's no scripts/ inside homedir,
- * use argv[0] (bprogname) to get .blender/ in
- * Blender's installation dir */
- s = BLI_last_slash( bprogname );
-
- i = s - bprogname + 1;
-
- PyOS_snprintf( bprogdir, i, "%s", bprogname );
-
- /* using tmpdir to preserve homedir (if) found above:
- * the ideal is to have a home dir with scripts dir inside
- * it, but if that isn't available, it's possible to
- * have a 'broken' home dir somewhere and a scripts dir in the
- * cvs sources */
- BLI_make_file_string( "/", tmpdir, bprogdir, ".blender" );
-
- if (BLI_exists(tmpdir)) {
- if (append_scriptsdir) {
- BLI_make_file_string("/", scriptsdir, tmpdir, "scripts");
- if (BLI_exists(scriptsdir)) {
- PyOS_snprintf(homedir, FILE_MAXDIR, "%s", tmpdir);
- return scriptsdir;
- }
- else {
- homedir[0] = '\0';
- scriptsdir[0] = '\0';
- }
- }
- else return homedir;
- }
-
- /* last try for scripts dir: blender in cvs dir, scripts/ inside release/: */
- if (append_scriptsdir) {
- BLI_make_file_string("/", scriptsdir, bprogdir, "release/scripts");
- if (BLI_exists(scriptsdir)) return scriptsdir;
- else scriptsdir[0] = '\0';
- }
-
- return NULL;
+ return homedir;
}
/* PyDrivers */