[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [30310] trunk/blender/source/blender/ blenlib/intern/path_util.c: Fix for #22818: blender doesn' t find a systemwide installed python.

Brecht Van Lommel brecht at blender.org
Wed Jul 14 12:44:35 CEST 2010


Revision: 30310
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=30310
Author:   blendix
Date:     2010-07-14 12:44:34 +0200 (Wed, 14 Jul 2010)

Log Message:
-----------
Fix for #22818: blender doesn't find a systemwide installed python.

What happens is that blender looks for a directory "python" in the same
place as the executable for local installations, but that also means when
you have /usr/bin/blender it will look for /usr/bin/python, which is an
executable. Now it checks if it is actually a directory and not a file.

Modified Paths:
--------------
    trunk/blender/source/blender/blenlib/intern/path_util.c

Modified: trunk/blender/source/blender/blenlib/intern/path_util.c
===================================================================
--- trunk/blender/source/blender/blenlib/intern/path_util.c	2010-07-14 10:02:43 UTC (rev 30309)
+++ trunk/blender/source/blender/blenlib/intern/path_util.c	2010-07-14 10:44:34 UTC (rev 30310)
@@ -747,7 +747,7 @@
 		ret = getenv("HOME");
 		if(ret) {
 			sprintf(dir, "%s\\%s", ret, blender_version_decimal());
-			if (BLI_exists(dir)) return dir;
+			if (BLI_is_dir(dir)) return dir;
 		}
 
 		/* else, check install dir (path containing blender.exe) */
@@ -755,7 +755,7 @@
 		if(BLI_getInstallationDir(dir))
 		{
 			sprintf(dir, "%s", dir, blender_version_decimal());
-			if (BLI_exists(dir)) return(dir);
+			if (BLI_is_dir(dir)) return(dir);
 		}
 
 				
@@ -768,24 +768,24 @@
 		
 		if (hResult == S_OK)
 		{
-			if (BLI_exists(appdatapath)) { /* from fop, also below... */
+			if (BLI_is_dir(appdatapath)) { /* from fop, also below... */
 				sprintf(dir, "%s\\Blender Foundation\\Blender", appdatapath);
 				BLI_recurdir_fileops(dir);
-				if (BLI_exists(dir)) {
+				if (BLI_is_dir(dir)) {
 					sprintf(dir,"%s\\%s", dir, blender_version_decimal());
-					if(BLI_exists(dir)) return(dir);
+					if(BLI_is_dir(dir)) return(dir);
 				}
 			}
 			hResult = SHGetFolderPath(NULL, CSIDL_COMMON_APPDATA, NULL, SHGFP_TYPE_CURRENT, appdatapath);
 			if (hResult == S_OK)
 			{
-				if (BLI_exists(appdatapath)) 
+				if (BLI_is_dir(appdatapath)) 
 				{ /* from fop, also below... */
 					sprintf(dir, "%s\\Blender Foundation\\Blender", appdatapath);
 					BLI_recurdir_fileops(dir);
-					if (BLI_exists(dir)) {
+					if (BLI_is_dir(dir)) {
 						sprintf(dir,"%s\\%s", dir, blender_version_decimal());
-						if(BLI_exists(dir)) return(dir);
+						if(BLI_is_dir(dir)) return(dir);
 					}
 				}
 			}
@@ -809,7 +809,7 @@
 	
 	BLI_make_file_string("/", targetpath, tmppath, folder_name);
 	
-	if (BLI_exists(targetpath)) {
+	if (BLI_is_dir(targetpath)) {
 #ifdef PATH_DEBUG
 		printf("\tpath found: %s\n", targetpath);
 #endif
@@ -932,7 +932,7 @@
 	
 	BLI_make_file_string("/", targetpath, tmppath, folder_name);
 	
-	if (BLI_exists(targetpath)) {
+	if (BLI_is_dir(targetpath)) {
 #ifdef PATH_DEBUG2
 		printf("\tpath found: %s\n", targetpath);
 #endif
@@ -952,7 +952,7 @@
 	char *env = envvar?getenv(envvar):NULL;
 	if (!env) return 0;
 	
-	if (BLI_exists(env)) {
+	if (BLI_is_dir(env)) {
 		BLI_strncpy(path, env, FILE_MAX);
 		return 1;
 	} else {
@@ -1245,7 +1245,7 @@
 	a = strlen(dir);
 	
 #ifdef WIN32	
-	while(BLI_exists(dir) == 0){
+	while(BLI_is_dir(dir) == 0){
 		a --;
 		while(dir[a] != '\\'){
 			a--;
@@ -1259,7 +1259,7 @@
 		}
 	}
 #else
-	while(BLI_exist(dir) == 0){
+	while(BLI_is_dir(dir) == 0){
 		a --;
 		while(dir[a] != '/'){
 			a--;
@@ -1682,7 +1682,7 @@
 {
 	fullname[0] = '\0';
 	
-	if (usertemp && BLI_exists(U.tempdir)) {
+	if (usertemp && BLI_is_dir(U.tempdir)) {
 		strcpy(fullname, U.tempdir);
 	}
 	
@@ -1690,7 +1690,7 @@
 #ifdef WIN32
 	if (fullname[0] == '\0') {
 		char *tmp = getenv("TEMP"); /* Windows */
-		if (tmp && BLI_exists(tmp)) {
+		if (tmp && BLI_is_dir(tmp)) {
 			strcpy(fullname, tmp);
 		}
 	}
@@ -1698,14 +1698,14 @@
 	/* Other OS's - Try TMP and TMPDIR */
 	if (fullname[0] == '\0') {
 		char *tmp = getenv("TMP");
-		if (tmp && BLI_exists(tmp)) {
+		if (tmp && BLI_is_dir(tmp)) {
 			strcpy(fullname, tmp);
 		}
 	}
 	
 	if (fullname[0] == '\0') {
 		char *tmp = getenv("TMPDIR");
-		if (tmp && BLI_exists(tmp)) {
+		if (tmp && BLI_is_dir(tmp)) {
 			strcpy(fullname, tmp);
 		}
 	}





More information about the Bf-blender-cvs mailing list