Add PS Vita port.
Thanks to Anton Stenmark.
This commit is contained in:
11
src/lib_os.c
11
src/lib_os.c
@@ -7,7 +7,6 @@
|
||||
*/
|
||||
|
||||
#include <errno.h>
|
||||
#include <locale.h>
|
||||
#include <time.h>
|
||||
|
||||
#define lib_os_c
|
||||
@@ -27,6 +26,10 @@
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
|
||||
#if !LJ_TARGET_PSVITA
|
||||
#include <locale.h>
|
||||
#endif
|
||||
|
||||
/* ------------------------------------------------------------------------ */
|
||||
|
||||
#define LJLIB_MODULE_os
|
||||
@@ -70,7 +73,7 @@ LJLIB_CF(os_rename)
|
||||
|
||||
LJLIB_CF(os_tmpname)
|
||||
{
|
||||
#if LJ_TARGET_PS3 || LJ_TARGET_PS4
|
||||
#if LJ_TARGET_PS3 || LJ_TARGET_PS4 || LJ_TARGET_PSVITA
|
||||
lj_err_caller(L, LJ_ERR_OSUNIQF);
|
||||
return 0;
|
||||
#else
|
||||
@@ -254,6 +257,9 @@ LJLIB_CF(os_difftime)
|
||||
|
||||
LJLIB_CF(os_setlocale)
|
||||
{
|
||||
#if LJ_TARGET_PSVITA
|
||||
lua_pushliteral(L, "C");
|
||||
#else
|
||||
GCstr *s = lj_lib_optstr(L, 1);
|
||||
const char *str = s ? strdata(s) : NULL;
|
||||
int opt = lj_lib_checkopt(L, 2, 6,
|
||||
@@ -265,6 +271,7 @@ LJLIB_CF(os_setlocale)
|
||||
else if (opt == 4) opt = LC_MONETARY;
|
||||
else if (opt == 6) opt = LC_ALL;
|
||||
lua_pushstring(L, setlocale(opt, str));
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user