Files
dnf-utils/sgutil/sgu_lua_utils.cpp
2025-09-03 09:34:30 +08:00

43 lines
944 B
C++

#include "sgu_lua_utils.h"
#include "libNPK_Utils.h"
#include <strsafe.h>
#include <Shlwapi.h>
#include <algorithm>
extern "C"
{
#include "lua.h"
#include "lualib.h"
#include "lauxlib.h"
};
#include "lua_tinker.h"
//utf8
bool luaForceCreatePathForFile(const char* szPath)
{
std::wstring strPath = convertUtf8StringToWide(szPath);
return forceCreatePathForFile(strPath.c_str());
}
//utf8
bool luaForceCreatePath(const char* szPath)
{
std::wstring strPath = convertUtf8StringToWide(szPath);
return forceCreatePath(strPath.c_str());
}
//utf8
bool luaCreateEmptyPath(const char* szPath)
{
std::wstring strPath = convertUtf8StringToWide(szPath);
return createEmptyPath(strPath.c_str());
}
void registerUtilsLuaLibs(struct lua_State* L)
{
lua_tinker::def(L, "forceCreatePath", &luaForceCreatePath);
lua_tinker::def(L, "forceCreatePathForFile", &luaForceCreatePathForFile);
lua_tinker::def(L, "createEmptyPath", &luaCreateEmptyPath);
}