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.
This commit is contained in:
Brecht Van Lommel
2010-07-14 10:44:34 +00:00
parent 7ad8e5b6f8
commit ee9437f794

View File

@@ -747,7 +747,7 @@ char *BLI_gethome(void) {
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 @@ char *BLI_gethome(void) {
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 @@ char *BLI_gethome(void) {
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 @@ static int test_data_path(char *targetpath, char *path_base, char *path_sep, cha
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 @@ static int test_path(char *targetpath, char *path_base, char *path_sep, char *fo
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 @@ static int test_env_path(char *path, char *envvar)
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 @@ void BLI_make_exist(char *dir) {
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 @@ void BLI_make_exist(char *dir) {
}
}
#else
while(BLI_exist(dir) == 0){
while(BLI_is_dir(dir) == 0){
a --;
while(dir[a] != '/'){
a--;
@@ -1682,7 +1682,7 @@ void BLI_where_is_temp(char *fullname, int usertemp)
{
fullname[0] = '\0';
if (usertemp && BLI_exists(U.tempdir)) {
if (usertemp && BLI_is_dir(U.tempdir)) {
strcpy(fullname, U.tempdir);
}
@@ -1690,7 +1690,7 @@ void BLI_where_is_temp(char *fullname, int usertemp)
#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 @@ void BLI_where_is_temp(char *fullname, int usertemp)
/* 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);
}
}