diff options
author | João Valverde <j@v6e.pt> | 2023-01-20 14:06:59 +0000 |
---|---|---|
committer | João Valverde <j@v6e.pt> | 2023-01-20 22:30:26 +0000 |
commit | 39124f2f8f3419b624a9e3bab9fac4c2cfe23e18 (patch) | |
tree | b3dcef41606cb51985e006ae2a906ddf256ed95e /wsutil | |
parent | b230aa1df03b5465bd0bbfdb3fe15b4fca443a21 (diff) |
Fix Personal Extcap folder path
The personal extcap folder $XDG_CONFIG_DIR/wireshark on Linux is
inconsistent with the global extcap folder (lib/wireshark/extcap)
and personal plugins folder (.local/lib/wireshark/plugins) and also
the configuration folder should not contain architecture-specific files.
The extcap personal folder is changed from:
.config/wireshark/extcap
to:
.local/lib/wireshark/extcap
Diffstat (limited to 'wsutil')
-rw-r--r-- | wsutil/filesystem.c | 24 | ||||
-rw-r--r-- | wsutil/filesystem.h | 5 |
2 files changed, 29 insertions, 0 deletions
diff --git a/wsutil/filesystem.c b/wsutil/filesystem.c index 2785ca6baf..e905fc5e4d 100644 --- a/wsutil/filesystem.c +++ b/wsutil/filesystem.c @@ -49,6 +49,7 @@ #define PROFILES_DIR "profiles" #define PLUGINS_DIR_NAME "plugins" +#define EXTCAP_DIR_NAME "extcap" #define PROFILES_INFO_NAME "profile_files.txt" #define _S G_DIR_SEPARATOR_S @@ -1124,6 +1125,7 @@ static char *plugin_dir = NULL; static char *plugin_dir_with_version = NULL; static char *plugin_pers_dir = NULL; static char *plugin_pers_dir_with_version = NULL; +static char *extcap_pers_dir = NULL; static void init_plugin_dir(void) @@ -1351,6 +1353,17 @@ init_extcap_dir(void) #endif } +static void +init_extcap_pers_dir(void) +{ +#ifdef _WIN32 + extcap_pers_dir = get_persconffile_path(EXTCAP_DIR_NAME, FALSE); +#else + extcap_pers_dir = g_build_filename(g_get_home_dir(), ".local/lib", + CONFIGURATION_NAMESPACE_LOWER, EXTCAP_DIR_NAME, (gchar *)NULL); +#endif +} + /* * Get the directory in which the extcap hooks are stored. * @@ -1363,6 +1376,15 @@ get_extcap_dir(void) return extcap_dir; } +/* Get the personal plugin dir */ +const char * +get_extcap_pers_dir(void) +{ + if (!extcap_pers_dir) + init_extcap_pers_dir(); + return extcap_pers_dir; +} + /* * Get the flag indicating whether we're running from a build * directory. @@ -2656,6 +2678,8 @@ free_progdirs(void) #endif g_free(extcap_dir); extcap_dir = NULL; + g_free(extcap_pers_dir); + extcap_pers_dir = NULL; } /* diff --git a/wsutil/filesystem.h b/wsutil/filesystem.h index 19c9db81f7..5700368027 100644 --- a/wsutil/filesystem.h +++ b/wsutil/filesystem.h @@ -103,6 +103,11 @@ WS_DLL_PUBLIC const char *get_plugins_pers_dir_with_version(void); WS_DLL_PUBLIC const char *get_extcap_dir(void); /* + * Get the personal extcap dir. + */ +WS_DLL_PUBLIC const char *get_extcap_pers_dir(void); + +/* * Get the flag indicating whether we're running from a build * directory. */ |