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
This commit is contained in:
João Valverde 2023-01-20 14:06:59 +00:00
parent b230aa1df0
commit 39124f2f8f
4 changed files with 36 additions and 2 deletions

View File

@ -28,6 +28,11 @@ Display filter autocomplete is smarter about not suggesting invalid syntax.
The Windows build has a new SpeexDSP external dependency (https://www.speex.org).
The speex code that was previously bundled has been removed.
The personal extcap plugin folder location on Unix has been changed to
follow existing conventions for architecture-dependent files.
The extcap personal folder is now ``$HOME/.local/lib/extcap``.
Previously it was ``$XDG_CONFIG_HOME/wireshark/extcap``.
Many other improvements have been made.
See the “New and Updated Features” section below for more details.

View File

@ -215,8 +215,8 @@ FolderListModel::FolderListModel(QObject * parent):
#endif
/* Extcap */
appendRow(QStringList() << tr("Personal Extcap path") << QString(get_persconffile_path("extcap", FALSE)).trimmed() << tr("external capture (extcap) plugins"));
appendRow(QStringList() << tr("Global Extcap path") << QString(get_extcap_dir()).trimmed() << tr("external capture (extcap) plugins"));
appendRow(QStringList() << tr("Personal Extcap path") << QString(get_extcap_pers_dir()) << tr("external capture (extcap) plugins"));
appendRow(QStringList() << tr("Global Extcap path") << QString(get_extcap_dir()) << tr("external capture (extcap) plugins"));
#ifdef HAVE_MAXMINDDB
/* MaxMind DB */

View File

@ -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;
}
/*

View File

@ -102,6 +102,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.