diff --git a/include/wx/utils.h b/include/wx/utils.h index 0235857076..a737731cac 100644 --- a/include/wx/utils.h +++ b/include/wx/utils.h @@ -86,6 +86,10 @@ WXDLLEXPORT int wxGetOsVersion(int *majorVsn = (int *) NULL, // Return a string with the current date/time WXDLLEXPORT wxString wxNow(); +// Return path where wxWindows is installed (mostly useful in Unices) +WXDLLEXPORT const wxChar *wxGetInstallPrefix(); + + #if wxUSE_GUI // Don't synthesize KeyUp events holding down a key and producing // KeyDown events with autorepeat. On by default and always on diff --git a/src/common/utilscmn.cpp b/src/common/utilscmn.cpp index f9f3116ca3..a294d53d5d 100644 --- a/src/common/utilscmn.cpp +++ b/src/common/utilscmn.cpp @@ -1072,6 +1072,21 @@ bool wxSetDetectableAutoRepeat( bool WXUNUSED(flag) ) #endif // wxUSE_GUI +const wxChar *wxGetInstallPrefix() +{ + wxString prefix; + + if ( wxGetEnv(wxT("WX_PREFIX"), &prefix) ) + return prefix.c_str(); + +#ifdef wxINSTALL_PREFIX + return wxT(wxINSTALL_PREFIX); +#else + return wxT(""); +#endif +} + + // ---------------------------------------------------------------------------- // network and user id functions // ---------------------------------------------------------------------------- diff --git a/src/generic/dcpsg.cpp b/src/generic/dcpsg.cpp index 73ee7231f0..701c26e46f 100644 --- a/src/generic/dcpsg.cpp +++ b/src/generic/dcpsg.cpp @@ -2034,7 +2034,7 @@ void wxPostScriptDC::DoGetTextExtent(const wxString& string, - afmFile = fopen() may fail and in that case the next if branch MUST be executed - and it would not if there was "else" */ { - afmName = wxINSTALL_PREFIX; + afmName = wxGetInstallPrefix(); afmName << wxFILE_SEP_PATH << wxT("share") << wxFILE_SEP_PATH << wxT("wx") << wxFILE_SEP_PATH