diff options
author | Adam Harrison <adamdharrison@gmail.com> | 2024-03-02 23:41:13 -0500 |
---|---|---|
committer | Adam Harrison <adamdharrison@gmail.com> | 2024-03-02 23:41:13 -0500 |
commit | 1b294574518b43cd8a786e6f380ff7869c5250e1 (patch) | |
tree | 0ce0df2723254fad7e78908bb72a2befaac90be1 /src/lpm.c | |
parent | 134c144ab7deceafa14eed60722ae3604917ea92 (diff) | |
download | lite-xl-plugin-manager-1b294574518b43cd8a786e6f380ff7869c5250e1.tar.gz lite-xl-plugin-manager-1b294574518b43cd8a786e6f380ff7869c5250e1.zip |
Added in ability to self-upgrade.
Diffstat (limited to 'src/lpm.c')
-rw-r--r-- | src/lpm.c | 25 |
1 files changed, 17 insertions, 8 deletions
@@ -1289,14 +1289,6 @@ static const luaL_Reg system_lib[] = { { NULL, NULL } }; - -#ifndef LPM_VERSION - #define LPM_VERSION "unknown" -#endif -#ifndef LPM_DEFAULT_REPO - #define LPM_DEFAULT_REPOSITORY "https://github.com/lite-xl/lite-xl-plugin-manager.git:latest" -#endif - #ifndef ARCH_PROCESSOR #if defined(__x86_64__) || defined(_M_AMD64) || defined(__MINGW64__) #define ARCH_PROCESSOR "x86_64" @@ -1331,6 +1323,21 @@ static const luaL_Reg system_lib[] = { #define LITE_ARCH_TUPLE ARCH_PROCESSOR "-" ARCH_PLATFORM #endif + +#ifndef LPM_VERSION + #define LPM_VERSION "unknown" +#endif +#ifndef LPM_DEFAULT_REPOSITORY + #define LPM_DEFAULT_REPOSITORY "https://github.com/lite-xl/lite-xl-plugin-manager.git:latest" +#endif +#ifndef LPM_DEFAULT_RELEASE + #if _WIN32 + #define LPM_DEFAULT_RELEASE "https://github.com/lite-xl/lite-xl-plugin-manager/releases/download/%r/lpm." LITE_ARCH_TUPLE ".exe" + #else + #define LPM_DEFAULT_RELEASE "https://github.com/lite-xl/lite-xl-plugin-manager/releases/download/%r/lpm." LITE_ARCH_TUPLE + #endif +#endif + #ifdef LPM_STATIC extern const char lpm_luac[]; extern unsigned int lpm_luac_len; @@ -1363,6 +1370,8 @@ int main(int argc, char* argv[]) { lua_setglobal(L, "ARCH"); lua_pushliteral(L, LPM_DEFAULT_REPOSITORY); lua_setglobal(L, "DEFAULT_REPO_URL"); + lua_pushliteral(L, LPM_DEFAULT_RELEASE); + lua_setglobal(L, "DEFAULT_RELEASE_URL"); #ifndef LPM_STATIC if (luaL_loadfile(L, "src/lpm.lua") || lua_pcall(L, 0, 1, 0)) { #else |