sdl: filesystem: add warning message to SDL_GetBasePath() and SDL_GetPrefPath() if used on older SDL2 versions
@@ -3,22 +3,19 @@ package sdl
/*
#include "sdl_wrapper.h"
-static inline char* _SDL_GetBasePath() {
-#if (SDL_VERSION_ATLEAST(2,0,1))
- return SDL_GetBasePath();
-#else
+#if !(SDL_VERSION_ATLEAST(2,0,1))
+#pragma message("SDL_GetBasePath is not supported before SDL 2.0.1")
+static inline char* SDL_GetBasePath()
+{
return NULL;
-#endif
}
-static inline char* _SDL_GetPrefPath(const char *org, const char *app)
+#pragma message("SDL_GetPrefPath is not supported before SDL 2.0.1")
+static inline char* SDL_GetPrefPath(const char *org, const char *app)
{
-#if (SDL_VERSION_ATLEAST(2,0,1))
- return SDL_GetPrefPath(org, app);
-#else
return NULL;
-#endif
}
+#endif
*/
import "C"
@@ -26,7 +23,7 @@ import "unsafe"
// GetBasePath (https://wiki.libsdl.org/SDL_GetBasePath)
func GetBasePath() string {
- _val := C._SDL_GetBasePath()
+ _val := C.SDL_GetBasePath()
defer C.SDL_free(unsafe.Pointer(_val))
return C.GoString(_val)
}
@@ -37,7 +34,7 @@ func GetPrefPath(org, app string) string {
_app := C.CString(app)
defer C.free(unsafe.Pointer(_org))
defer C.free(unsafe.Pointer(_app))
- _val := C._SDL_GetPrefPath(_org, _app)
+ _val := C.SDL_GetPrefPath(_org, _app)
defer C.SDL_free(unsafe.Pointer(_val))
return C.GoString(_val)
}
