mirror of
https://github.com/aseprite/aseprite.git
synced 2024-12-30 21:18:34 +00:00
lua: use our base::open_file_raw to open files from io lib funcs
This commit is contained in:
parent
4a35e20adf
commit
eb56884677
@ -14,6 +14,7 @@
|
||||
#include "app/console.h"
|
||||
#include "app/script/luacpp.h"
|
||||
#include "base/chrono.h"
|
||||
#include "base/file_handle.h"
|
||||
#include "base/fs.h"
|
||||
#include "base/fstream_path.h"
|
||||
#include "doc/anidir.h"
|
||||
@ -109,6 +110,13 @@ void register_sprites_class(lua_State* L);
|
||||
void register_tag_class(lua_State* L);
|
||||
void register_tags_class(lua_State* L);
|
||||
|
||||
// We use our own fopen() that supports Unicode filename on Windows
|
||||
extern "C" FILE* lua_user_fopen(const char* fname,
|
||||
const char* mode)
|
||||
{
|
||||
return base::open_file_raw(fname, mode);
|
||||
}
|
||||
|
||||
Engine::Engine()
|
||||
: L(luaL_newstate())
|
||||
, m_delegate(nullptr)
|
||||
@ -122,12 +130,13 @@ Engine::Engine()
|
||||
luaL_requiref(L, LUA_GNAME, luaopen_base, 1);
|
||||
luaL_requiref(L, LUA_COLIBNAME, luaopen_coroutine, 1);
|
||||
luaL_requiref(L, LUA_TABLIBNAME, luaopen_table, 1);
|
||||
luaL_requiref(L, LUA_IOLIBNAME, luaopen_io, 1);
|
||||
luaL_requiref(L, LUA_OSLIBNAME, luaopen_os, 1);
|
||||
luaL_requiref(L, LUA_STRLIBNAME, luaopen_string, 1);
|
||||
luaL_requiref(L, LUA_MATHLIBNAME, luaopen_math, 1);
|
||||
luaL_requiref(L, LUA_UTF8LIBNAME, luaopen_utf8, 1);
|
||||
luaL_requiref(L, LUA_DBLIBNAME, luaopen_debug, 1);
|
||||
lua_pop(L, 8);
|
||||
lua_pop(L, 9);
|
||||
|
||||
// Overwrite Lua functions
|
||||
lua_register(L, "print", print);
|
||||
|
Loading…
Reference in New Issue
Block a user