aboutsummaryrefslogtreecommitdiff
path: root/src/lib_os.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/lib_os.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/lib_os.c b/src/lib_os.c
index 76ffcaa8..68678492 100644
--- a/src/lib_os.c
+++ b/src/lib_os.c
@@ -7,7 +7,6 @@
7*/ 7*/
8 8
9#include <errno.h> 9#include <errno.h>
10#include <locale.h>
11#include <time.h> 10#include <time.h>
12 11
13#define lib_os_c 12#define lib_os_c
@@ -30,6 +29,10 @@
30#include <stdio.h> 29#include <stdio.h>
31#endif 30#endif
32 31
32#if !LJ_TARGET_PSVITA
33#include <locale.h>
34#endif
35
33/* ------------------------------------------------------------------------ */ 36/* ------------------------------------------------------------------------ */
34 37
35#define LJLIB_MODULE_os 38#define LJLIB_MODULE_os
@@ -73,7 +76,7 @@ LJLIB_CF(os_rename)
73 76
74LJLIB_CF(os_tmpname) 77LJLIB_CF(os_tmpname)
75{ 78{
76#if LJ_TARGET_PS3 || LJ_TARGET_PS4 79#if LJ_TARGET_PS3 || LJ_TARGET_PS4 || LJ_TARGET_PSVITA
77 lj_err_caller(L, LJ_ERR_OSUNIQF); 80 lj_err_caller(L, LJ_ERR_OSUNIQF);
78 return 0; 81 return 0;
79#else 82#else
@@ -259,6 +262,9 @@ LJLIB_CF(os_difftime)
259 262
260LJLIB_CF(os_setlocale) 263LJLIB_CF(os_setlocale)
261{ 264{
265#if LJ_TARGET_PSVITA
266 lua_pushliteral(L, "C");
267#else
262 GCstr *s = lj_lib_optstr(L, 1); 268 GCstr *s = lj_lib_optstr(L, 1);
263 const char *str = s ? strdata(s) : NULL; 269 const char *str = s ? strdata(s) : NULL;
264 int opt = lj_lib_checkopt(L, 2, 6, 270 int opt = lj_lib_checkopt(L, 2, 6,
@@ -270,6 +276,7 @@ LJLIB_CF(os_setlocale)
270 else if (opt == 4) opt = LC_MONETARY; 276 else if (opt == 4) opt = LC_MONETARY;
271 else if (opt == 6) opt = LC_ALL; 277 else if (opt == 6) opt = LC_ALL;
272 lua_pushstring(L, setlocale(opt, str)); 278 lua_pushstring(L, setlocale(opt, str));
279#endif
273 return 1; 280 return 1;
274} 281}
275 282