From 13599a6d12c42d25e3f03c6ea41f17919a512953 Mon Sep 17 00:00:00 2001 From: Lerg Date: Wed, 18 Aug 2021 14:45:00 +0200 Subject: [PATCH] Added getPrefPath() to the SDL lib. --- libs/sdl/sdl.c | 5 +++++ libs/sdl/sdl/Sdl.hx | 8 ++++++++ 2 files changed, 13 insertions(+) diff --git a/libs/sdl/sdl.c b/libs/sdl/sdl.c index 2158c736a..af10b6b5e 100644 --- a/libs/sdl/sdl.c +++ b/libs/sdl/sdl.c @@ -405,6 +405,10 @@ HL_PRIM const char *HL_NAME(detect_keyboard_layout)() { return "unknown"; } +HL_PRIM const char *HL_NAME(get_pref_path)(const char *org, const char *app) { + return SDL_GetPrefPath(org, app); +} + DEFINE_PRIM(_BOOL, init_once, _NO_ARG); DEFINE_PRIM(_VOID, gl_options, _I32 _I32 _I32 _I32 _I32 _I32); DEFINE_PRIM(_BOOL, event_loop, _DYN ); @@ -419,6 +423,7 @@ DEFINE_PRIM(_VOID, text_input, _BOOL); DEFINE_PRIM(_I32, set_relative_mouse_mode, _BOOL); DEFINE_PRIM(_BYTES, detect_keyboard_layout, _NO_ARG); DEFINE_PRIM(_BOOL, hint_value, _BYTES _BYTES); +DEFINE_PRIM(_BYTES, get_pref_path, _BYTES _BYTES); // Window diff --git a/libs/sdl/sdl/Sdl.hx b/libs/sdl/sdl/Sdl.hx index 633c7a1c1..2b324a690 100644 --- a/libs/sdl/sdl/Sdl.hx +++ b/libs/sdl/sdl/Sdl.hx @@ -143,6 +143,14 @@ class Sdl { else return @:privateAccess String.fromUTF8(t); } + + static function get_pref_path(org: hl.Bytes, app: hl.Bytes) : hl.Bytes { + return null; + } + + public static function getPrefPath(org: String, app: String) { + return @:privateAccess String.fromUTF8(get_pref_path(org.toUtf8(), app.toUtf8())); + } } @:enum