Skip to content
Extraits de code Groupes Projets
Vérifiée Valider 7810cbff rédigé par Kubat's avatar Kubat
Parcourir les fichiers

WIP: Patch PATH if it's an AppImage to search first inside it for path resolutions

parent 0dde9a8c
Aucune branche associée trouvée
Aucune étiquette associée trouvée
1 requête de fusion!144Resolve "Write MKV tags without mkvpropedit as a dependency for the AppImage"
...@@ -217,6 +217,8 @@ end: ...@@ -217,6 +217,8 @@ end:
return 0; return 0;
} }
static int ___is_appimage = 0;
static inline void static inline void
___resolve_appimage(void) ___resolve_appimage(void)
{ {
...@@ -232,6 +234,7 @@ ___resolve_appimage(void) ...@@ -232,6 +234,7 @@ ___resolve_appimage(void)
LOG_DEBUG("INIT", "AppImage env APPDIR = %s", env_APPDIR); LOG_DEBUG("INIT", "AppImage env APPDIR = %s", env_APPDIR);
LOG_DEBUG("INIT", "AppImage env OWD = %s", env_OWD); LOG_DEBUG("INIT", "AppImage env OWD = %s", env_OWD);
LOG_DEBUG("INIT", "AppImage env ARGV0 = %s", env_ARGV0); LOG_DEBUG("INIT", "AppImage env ARGV0 = %s", env_ARGV0);
___is_appimage = 1;
} else } else
LOG_DEBUG("INIT", "No AppImage env variable found!"); LOG_DEBUG("INIT", "No AppImage env variable found!");
} }
...@@ -240,6 +243,15 @@ static inline void ...@@ -240,6 +243,15 @@ static inline void
___resolve_path(void) ___resolve_path(void)
{ {
const char *env_PATH = getenv("PATH"); const char *env_PATH = getenv("PATH");
if (___is_appimage) {
char new_path[PATH_MAX];
char exe_path[LKT_LINE_MAX];
GOTO_IF(read_self_exe(exe_path, LKT_LINE_MAX), "Failed to get exe path", error);
char *self_dir = dirname(exe_path);
safe_snprintf(new_path, PATH_MAX, "%s:%s", self_dir, env_PATH);
GOTO_IF(setenv("PATH", new_path, 1), "Failed to set new PATH", error);
}
error:
LOG_DEBUG("INIT", "PATH is: %s", env_PATH); LOG_DEBUG("INIT", "PATH is: %s", env_PATH);
} }
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter