@@ -761,7 +761,7 @@ _readIni(const wchar_t *section, const wchar_t *settingName, wchar_t *buffer, in
761
761
n = GetPrivateProfileStringW (section , settingName , NULL , buffer , bufferLength , iniPath );
762
762
if (n ) {
763
763
debug (L"# Found %s in %s\n" , settingName , iniPath );
764
- return true ;
764
+ return n ;
765
765
} else if (GetLastError () == ERROR_FILE_NOT_FOUND ) {
766
766
debug (L"# Did not find file %s\n" , iniPath );
767
767
} else {
@@ -946,25 +946,29 @@ checkDefaults(SearchInfo *search)
946
946
947
947
// If tag is only a major version number, expand it from the environment
948
948
// or an ini file
949
- const wchar_t * settingName = NULL ;
949
+ const wchar_t * iniSettingName = NULL ;
950
+ const wchar_t * envSettingName = NULL ;
950
951
if (!search -> tag || !search -> tagLength ) {
951
- settingName = L"py_python" ;
952
+ iniSettingName = L"python" ;
953
+ envSettingName = L"py_python" ;
952
954
} else if (0 == wcsncmp (search -> tag , L"3" , search -> tagLength )) {
953
- settingName = L"py_python3" ;
955
+ iniSettingName = L"python3" ;
956
+ envSettingName = L"py_python3" ;
954
957
} else if (0 == wcsncmp (search -> tag , L"2" , search -> tagLength )) {
955
- settingName = L"py_python2" ;
958
+ iniSettingName = L"python2" ;
959
+ envSettingName = L"py_python2" ;
956
960
} else {
957
961
debug (L"# Cannot select defaults for tag '%.*s'\n" , search -> tagLength , search -> tag );
958
962
return 0 ;
959
963
}
960
964
961
965
// First, try to read an environment variable
962
966
wchar_t buffer [MAXLEN ];
963
- int n = GetEnvironmentVariableW (settingName , buffer , MAXLEN );
967
+ int n = GetEnvironmentVariableW (envSettingName , buffer , MAXLEN );
964
968
965
969
// If none found, check in our two .ini files instead
966
970
if (!n ) {
967
- n = _readIni (L"defaults" , settingName , buffer , MAXLEN );
971
+ n = _readIni (L"defaults" , iniSettingName , buffer , MAXLEN );
968
972
}
969
973
970
974
if (n ) {
0 commit comments