diff options
author | Adam <adamdharrison@gmail.com> | 2022-09-27 16:59:28 -0400 |
---|---|---|
committer | Adam <adamdharrison@gmail.com> | 2022-09-27 16:59:28 -0400 |
commit | ffb465457b8ff65fba40cda84faa55d5aaad8510 (patch) | |
tree | 111ad2ac238415bad863e7114d1b7bc9398cbc71 /lpm.c | |
parent | 399975a802ba26695abc4a68381c476c2224e4ad (diff) | |
download | lite-xl-plugin-manager-ffb465457b8ff65fba40cda84faa55d5aaad8510.tar.gz lite-xl-plugin-manager-ffb465457b8ff65fba40cda84faa55d5aaad8510.zip |
First brush with bottles.
Diffstat (limited to 'lpm.c')
-rw-r--r-- | lpm.c | 14 |
1 files changed, 14 insertions, 0 deletions
@@ -59,6 +59,18 @@ static int lpm_hash(lua_State* L) { return 1; } +int lpm_symlink(lua_State* L) { + if (symlink(luaL_checkstring(L, 1), luaL_checkstring(L, 2))) + return luaL_error(L, "can't create symlink %s: %s", luaL_checkstring(L, 2), strerror(errno)); + return 0; +} + +int lpm_chmod(lua_State* L) { + if (chmod(luaL_checkstring(L, 1)), luaL_checkinteger(L, 2)) + return luaL_error(L, "can't chmod %s: %s", luaL_checkstring(L, 1), strerror(errno)) + return 0; +} + /** BEGIN STOLEN LITE CODE **/ #if _WIN32 @@ -475,6 +487,8 @@ static const luaL_Reg system_lib[] = { { "mkdir", lpm_mkdir }, // Makes a directory. { "rmdir", lpm_rmdir }, // Removes a directory. { "hash", lpm_hash }, // Returns a hex sha256 hash. + { "symlink", lpm_symlink }, // Creates a symlink. + { "chmod", lpm_chmod }, // Chmod's a file. { "init", lpm_init }, // Initializes a git repository with the specified remote. { "fetch", lpm_fetch }, // Updates a git repository with the specified remote. { "reset", lpm_reset }, // Updates a git repository to the specified commit/hash/branch. |