aboutsummaryrefslogtreecommitdiffstats
path: root/wsutil/filesystem.c
diff options
context:
space:
mode:
authorJoão Valverde <joao.valverde@tecnico.ulisboa.pt>2017-09-18 16:25:20 +0100
committerJoão Valverde <j@v6e.pt>2017-09-20 16:41:21 +0000
commit25ba538bc50ff3a824185cca532f4e0feb4f8ec4 (patch)
treec2df4d54627a48815479f168900f195156e20f37 /wsutil/filesystem.c
parentf1501b82a7354de76a8d3833db2aa8fa8b9d62e0 (diff)
plugins: Be more descriptive in "about wireshark"->"folders"
Display separate entries for binary plugins and lua scripts. This is explained in the user guide, that the binary folder is a subfolder of the lua folder, but it's probably a good idea to be more explicit about it, at the risk of cluttering the interface a bit. Move GeoIP information down because it seems the least important. Add helper functions to provide plugin version subdir. Change some #ifdefs while at it for legibility. Change-Id: Ieb8665df029b3c14de19e2c973bd9b1cc4ec4621 Reviewed-on: https://code.wireshark.org/review/23609 Petri-Dish: João Valverde <j@v6e.pt> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: João Valverde <j@v6e.pt>
Diffstat (limited to 'wsutil/filesystem.c')
-rw-r--r--wsutil/filesystem.c46
1 files changed, 34 insertions, 12 deletions
diff --git a/wsutil/filesystem.c b/wsutil/filesystem.c
index fd0964975a..ea4629091b 100644
--- a/wsutil/filesystem.c
+++ b/wsutil/filesystem.c
@@ -935,7 +935,6 @@ get_datafile_dir(void)
return datafile_dir;
}
-#if defined(HAVE_PLUGINS) || defined(HAVE_LUA)
/*
* Find the directory where the plugins are stored.
*
@@ -959,11 +958,14 @@ get_datafile_dir(void)
* configure script.
*/
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 void
init_plugin_dir(void)
{
+#if defined(HAVE_PLUGINS) || defined(HAVE_LUA)
#ifdef _WIN32
/*
* On Windows, the data file directory is the installation
@@ -1032,45 +1034,61 @@ init_plugin_dir(void)
}
}
#endif
+#endif /* defined(HAVE_PLUGINS) || defined(HAVE_LUA) */
}
static void
init_plugin_pers_dir(void)
{
+#if defined(HAVE_PLUGINS) || defined(HAVE_LUA)
#ifdef _WIN32
plugin_pers_dir = get_persconffile_path(PLUGINS_DIR_NAME, FALSE);
#else
plugin_pers_dir = g_build_filename(g_get_home_dir(), ".local/lib/wireshark/" PLUGINS_DIR_NAME, (gchar *)NULL);
#endif
+#endif /* defined(HAVE_PLUGINS) || defined(HAVE_LUA) */
}
-#endif /* HAVE_PLUGINS || HAVE_LUA */
-
/*
* Get the directory in which the plugins are stored.
*/
const char *
get_plugins_dir(void)
{
-#if defined(HAVE_PLUGINS) || defined(HAVE_LUA)
- if (!plugin_dir) init_plugin_dir();
+ if (!plugin_dir)
+ init_plugin_dir();
return plugin_dir;
-#else
- return NULL;
-#endif
+}
+
+const char *
+get_plugins_dir_with_version(void)
+{
+ if (!plugin_dir)
+ init_plugin_dir();
+ if (plugin_dir && !plugin_dir_with_version)
+ plugin_dir_with_version = g_strdup_printf("%s" G_DIR_SEPARATOR_S "%d.%d",
+ plugin_dir, VERSION_MAJOR, VERSION_MINOR);
+ return plugin_dir_with_version;
}
/* Get the personal plugin dir */
const char *
get_plugins_pers_dir(void)
{
-#if defined(HAVE_PLUGINS) || defined(HAVE_LUA)
if (!plugin_pers_dir)
init_plugin_pers_dir();
return plugin_pers_dir;
-#else
- return NULL;
-#endif
+}
+
+const char *
+get_plugins_pers_dir_with_version(void)
+{
+ if (!plugin_pers_dir)
+ init_plugin_pers_dir();
+ if (plugin_pers_dir && !plugin_pers_dir_with_version)
+ plugin_pers_dir_with_version = g_strdup_printf("%s" G_DIR_SEPARATOR_S "%d.%d",
+ plugin_pers_dir, VERSION_MAJOR, VERSION_MINOR);
+ return plugin_pers_dir_with_version;
}
#if defined(HAVE_EXTCAP)
@@ -2244,8 +2262,12 @@ free_progdirs(void)
#if defined(HAVE_PLUGINS) || defined(HAVE_LUA)
g_free(plugin_dir);
plugin_dir = NULL;
+ g_free(plugin_dir_with_version);
+ plugin_dir_with_version = NULL;
g_free(plugin_pers_dir);
plugin_pers_dir = NULL;
+ g_free(plugin_pers_dir_with_version);
+ plugin_pers_dir_with_version = NULL;
#endif
#ifdef HAVE_EXTCAP
g_free(extcap_dir);