Add wxIsRunningUnderWine() helper function
This is mostly useful in the testing code to avoid failures when testing for functionality not implemented by Wine.
This commit is contained in:
@@ -429,6 +429,11 @@ protected:
|
||||
wxString m_cpuArch;
|
||||
};
|
||||
|
||||
|
||||
// Returns true only for MSW programs running under Wine.
|
||||
#ifdef __WINDOWS__
|
||||
WXDLLIMPEXP_BASE bool wxIsRunningUnderWine();
|
||||
#else // !__WINDOWS__
|
||||
inline bool wxIsRunningUnderWine() { return false; }
|
||||
#endif // __WINDOWS__/!__WINDOWS__
|
||||
|
||||
#endif // _WX_PLATINFO_H_
|
||||
|
@@ -629,3 +629,16 @@ public:
|
||||
|
||||
//@}
|
||||
};
|
||||
|
||||
/**
|
||||
Returns true only for MSW programs running under Wine.
|
||||
|
||||
This function can be used to check for some functionality not implemented
|
||||
when using Wine.
|
||||
|
||||
@since 3.1.6
|
||||
|
||||
@library{wxbase}
|
||||
@category{cfg}
|
||||
*/
|
||||
bool wxIsRunningUnderWine();
|
||||
|
@@ -29,6 +29,10 @@
|
||||
|
||||
#include "wx/apptrait.h"
|
||||
|
||||
#ifdef __WINDOWS__
|
||||
#include "wx/dynlib.h"
|
||||
#endif
|
||||
|
||||
// global object
|
||||
// VERY IMPORTANT: do not use the default constructor since it would
|
||||
// try to init the wxPlatformInfo instance using
|
||||
@@ -373,3 +377,12 @@ wxEndianness wxPlatformInfo::GetEndianness(const wxString& end)
|
||||
|
||||
return wxENDIAN_INVALID;
|
||||
}
|
||||
|
||||
#ifdef __WINDOWS__
|
||||
|
||||
bool wxIsRunningUnderWine()
|
||||
{
|
||||
return wxLoadedDLL("ntdll.dll").HasSymbol(wxS("wine_get_version"));
|
||||
}
|
||||
|
||||
#endif // __WINDOWS__
|
||||
|
Reference in New Issue
Block a user