summaryrefslogtreecommitdiff
blob: 398ccc5e9a9104d692baefdaf9436779fc06cce3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
--- 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 */