diff options
author | Adam Harrison <adamdharrison@gmail.com> | 2024-03-17 21:25:20 -0400 |
---|---|---|
committer | Adam Harrison <adamdharrison@gmail.com> | 2024-03-17 21:25:20 -0400 |
commit | 4b010fa276dad577094faaca41f4e2690eef8154 (patch) | |
tree | 7eb7c7a94f1d740432f0c442f022a8c87ff29a34 /src/lpm.c | |
parent | 3f7f832623359acea17fde32eaccc2fc92a21c84 (diff) | |
download | lite-xl-plugin-manager-4b010fa276dad577094faaca41f4e2690eef8154.tar.gz lite-xl-plugin-manager-4b010fa276dad577094faaca41f4e2690eef8154.zip |
Added in EXEFILE.
Diffstat (limited to 'src/lpm.c')
-rw-r--r-- | src/lpm.c | 16 |
1 files changed, 16 insertions, 0 deletions
@@ -1503,6 +1503,22 @@ int main(int argc, char* argv[]) { #endif lua_setglobal(L, "SYSTMPDIR"); + #if _WIN32 + wchar_t selfpath[MAX_PATH] = {0}; + if (GetModuleFileNameW(0, selfpath, MAX_PATH - 1)) + lua_toutf8(L, selfpath); + else + lua_pushnil(L); + #else + char selfpath[MAX_PATH] = {0}; + int length = readlink("/proc/self/exe", selfpath, MAX_PATH); + if (length > 0) + lua_pushlstring(L, selfpath, length); + else + lua_pushnil(L); + #endif + lua_setglobal(L, "EXEFILE"); + lua_pushliteral(L, LITE_ARCH_TUPLE); lua_setglobal(L, "ARCH"); lua_pushliteral(L, LPM_DEFAULT_REPOSITORY); |