mirror of
https://github.com/ctruLua/ctruLua.git
synced 2025-10-27 16:39:29 +00:00
Moved library path modifications to main.lua, made all paths relative
The library path can now be easlily modified. Instead of always launching /3ds/ctruLua/main.lua, ctruLua will now launch the main.lua in the current directory (the ctruLua.3dsx directory when launched with HBL). On citra, this will be the root of the sdmc directory.
This commit is contained in:
parent
81f8edb25d
commit
0efdc23576
6 changed files with 49 additions and 21 deletions
13
source/fs.c
13
source/fs.c
|
|
@ -1,4 +1,6 @@
|
|||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <3ds/types.h>
|
||||
#include <3ds/util/utf.h>
|
||||
|
|
@ -88,12 +90,15 @@ static int fs_setDirectory(lua_State *L) {
|
|||
|
||||
int result = chdir(path);
|
||||
|
||||
if (result == 0)
|
||||
if (result == 0) {
|
||||
lua_pushboolean(L, true);
|
||||
else
|
||||
lua_pushboolean(L, false);
|
||||
return 1;
|
||||
|
||||
return 1;
|
||||
} else {
|
||||
lua_pushboolean(L, false);
|
||||
lua_pushstring(L, strerror(errno));
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
|
||||
static const struct luaL_Reg fs_lib[] = {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue