diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2023-11-12 11:51:59 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2023-11-12 11:51:59 (GMT) |
commit | 1e34d59e3fb62bc699d4e561c89e68adbf594f4e (patch) | |
tree | 20b942bd277c614b0c70ad327d946b880056652d /src/core | |
parent | 3ee8ddcb181b8185b24a1de5ce6e509219883072 (diff) |
Retrieve the right plugin path in regular install modes.
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/paths.c | 49 |
1 files changed, 16 insertions, 33 deletions
diff --git a/src/core/paths.c b/src/core/paths.c index 5902e83..c9213bc 100644 --- a/src/core/paths.c +++ b/src/core/paths.c @@ -125,15 +125,13 @@ char *get_effective_directory(const char *template) char *get_effective_directory_new(TargetDirectoryType type) { char *result; /* Répertoire à retourner */ -#ifdef DISCARD_LOCAL +#if defined DISCARD_LOCAL && defined PYTHON_PACKAGE Dl_info info; /* Informations dynamiques */ int ret; /* Bilan d'une récupération */ char *dyn_path_tmp; /* Chemin d'accès modifiable */ const char *dyn_path; /* Chemin d'accès courant */ -# ifdef PYTHON_PACKAGE size_t len; /* Taille de comparaison */ size_t pos; /* Position dans une chaîne */ -# endif #endif /** @@ -155,20 +153,6 @@ char *get_effective_directory_new(TargetDirectoryType type) result = NULL; -#ifdef DISCARD_LOCAL - - ret = dladdr(__FUNCTION__, &info); - if (ret == 0) - { - LOG_ERROR_DL_N("dladdr"); - goto exit; - } - - dyn_path_tmp = strdup(info.dli_fname); - dyn_path = dirname(dyn_path_tmp); - -#endif - switch (type) { case TDT_PLUGINS_LIB: @@ -178,6 +162,16 @@ char *get_effective_directory_new(TargetDirectoryType type) #else # ifdef PYTHON_PACKAGE + ret = dladdr(__FUNCTION__, &info); + if (ret == 0) + { + LOG_ERROR_DL_N("dladdr"); + break; + } + + dyn_path_tmp = strdup(info.dli_fname); + dyn_path = dirname(dyn_path_tmp); + len = strlen("chrysalide-libs"); pos = strlen(dyn_path); @@ -193,9 +187,12 @@ char *get_effective_directory_new(TargetDirectoryType type) result[pos] = '\0'; result = stradd(result, "chrysalide-plugins"); + bad_sync: + + free(dyn_path_tmp); + # else - result = strdup(dyn_path); - result = stradd(result, G_DIR_SEPARATOR_S "chrysalide-plugins"); + result = strdup(PLUGINS_LIB_DIR); # endif #endif break; @@ -206,20 +203,6 @@ char *get_effective_directory_new(TargetDirectoryType type) } -#ifdef DISCARD_LOCAL - -# ifdef PYTHON_PACKAGE - - bad_sync: - -# endif - - free(dyn_path_tmp); - - exit: - -#endif - assert(result != NULL); return result; |