@@ -761,7 +761,7 @@ _readIni(const wchar_t *section, const wchar_t *settingName, wchar_t *buffer, in
761761 n = GetPrivateProfileStringW (section , settingName , NULL , buffer , bufferLength , iniPath );
762762 if (n ) {
763763 debug (L"# Found %s in %s\n" , settingName , iniPath );
764- return true ;
764+ return n ;
765765 } else if (GetLastError () == ERROR_FILE_NOT_FOUND ) {
766766 debug (L"# Did not find file %s\n" , iniPath );
767767 } else {
@@ -946,25 +946,29 @@ checkDefaults(SearchInfo *search)
946946
947947 // If tag is only a major version number, expand it from the environment
948948 // or an ini file
949- const wchar_t * settingName = NULL ;
949+ const wchar_t * iniSettingName = NULL ;
950+ const wchar_t * envSettingName = NULL ;
950951 if (!search -> tag || !search -> tagLength ) {
951- settingName = L"py_python" ;
952+ iniSettingName = L"python" ;
953+ envSettingName = L"py_python" ;
952954 } else if (0 == wcsncmp (search -> tag , L"3" , search -> tagLength )) {
953- settingName = L"py_python3" ;
955+ iniSettingName = L"python3" ;
956+ envSettingName = L"py_python3" ;
954957 } else if (0 == wcsncmp (search -> tag , L"2" , search -> tagLength )) {
955- settingName = L"py_python2" ;
958+ iniSettingName = L"python2" ;
959+ envSettingName = L"py_python2" ;
956960 } else {
957961 debug (L"# Cannot select defaults for tag '%.*s'\n" , search -> tagLength , search -> tag );
958962 return 0 ;
959963 }
960964
961965 // First, try to read an environment variable
962966 wchar_t buffer [MAXLEN ];
963- int n = GetEnvironmentVariableW (settingName , buffer , MAXLEN );
967+ int n = GetEnvironmentVariableW (envSettingName , buffer , MAXLEN );
964968
965969 // If none found, check in our two .ini files instead
966970 if (!n ) {
967- n = _readIni (L"defaults" , settingName , buffer , MAXLEN );
971+ n = _readIni (L"defaults" , iniSettingName , buffer , MAXLEN );
968972 }
969973
970974 if (n ) {
0 commit comments