lua: added file.mkdir
This commit is contained in:
@@ -88,6 +88,13 @@ static int l_file_length(lua_State* L) {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int l_file_mkdir(lua_State* L) {
|
||||||
|
auto paths = scripting::engine->getPaths();
|
||||||
|
fs::path path = paths->resolve(lua_tostring(L, 1));
|
||||||
|
lua_pushboolean(L, fs::create_directory(path));
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
static const luaL_Reg filelib [] = {
|
static const luaL_Reg filelib [] = {
|
||||||
{"resolve", l_file_resolve},
|
{"resolve", l_file_resolve},
|
||||||
{"read", l_file_read},
|
{"read", l_file_read},
|
||||||
@@ -96,6 +103,7 @@ static const luaL_Reg filelib [] = {
|
|||||||
{"isfile", l_file_isfile},
|
{"isfile", l_file_isfile},
|
||||||
{"isdir", l_file_isdir},
|
{"isdir", l_file_isdir},
|
||||||
{"length", l_file_length},
|
{"length", l_file_length},
|
||||||
|
{"mkdir", l_file_mkdir},
|
||||||
{NULL, NULL}
|
{NULL, NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user