diff options
-rw-r--r-- | debian/libwsutil0.symbols | 2 | ||||
-rw-r--r-- | tshark.c | 36 | ||||
-rw-r--r-- | ui/gtk/about_dlg.c | 44 | ||||
-rw-r--r-- | ui/qt/about_dialog.cpp | 40 | ||||
-rw-r--r-- | wsutil/filesystem.c | 46 | ||||
-rw-r--r-- | wsutil/filesystem.h | 10 | ||||
-rw-r--r-- | wsutil/plugins.c | 10 |
7 files changed, 121 insertions, 67 deletions
diff --git a/debian/libwsutil0.symbols b/debian/libwsutil0.symbols index c737a39bb7..f3f868ef0a 100644 --- a/debian/libwsutil0.symbols +++ b/debian/libwsutil0.symbols @@ -74,7 +74,9 @@ libwsutil.so.0 libwsutil0 #MINVER# get_persconffile_path@Base 1.12.0~rc1 get_persdatafile_dir@Base 1.12.0~rc1 get_plugins_dir@Base 2.5.0 + get_plugins_dir_with_version@Base 2.5.0 get_plugins_pers_dir@Base 1.12.0~rc1 + get_plugins_pers_dir_with_version@Base 2.5.0 get_positive_int@Base 1.99.0 get_profile_name@Base 1.12.0~rc1 get_profiles_dir@Base 1.12.0~rc1 @@ -611,12 +611,31 @@ about_folders(void) constpath = get_progfile_dir(); printf("%-21s\t%s\n", "Program:", constpath); -#if defined(HAVE_PLUGINS) || defined(HAVE_LUA) +#ifdef HAVE_PLUGINS /* pers plugins */ - printf("%-21s\t%s\n", "Personal Plugins:", get_plugins_pers_dir()); + printf("%-21s\t%s\n", "Personal Plugins:", get_plugins_pers_dir_with_version()); /* global plugins */ - printf("%-21s\t%s\n", "Global Plugins:", get_plugins_dir()); + printf("%-21s\t%s\n", "Global Plugins:", get_plugins_dir_with_version()); +#endif + +#ifdef HAVE_LUA + /* pers lua plugins */ + printf("%-21s\t%s\n", "Personal Lua Plugins:", get_plugins_pers_dir()); + + /* global lua plugins */ + printf("%-21s\t%s\n", "Global Lua Plugins:", get_plugins_dir()); +#endif + +#ifdef HAVE_EXTCAP + /* Extcap */ + constpath = get_extcap_dir(); + + resultArray = g_strsplit(constpath, G_SEARCHPATH_SEPARATOR_S, 10); + for(i = 0; resultArray[i]; i++) + printf("%-21s\t%s\n", "Extcap path:", g_strstrip(resultArray[i])); + + g_strfreev(resultArray); #endif #ifdef HAVE_GEOIP @@ -644,17 +663,6 @@ about_folders(void) g_free(path); #endif -#ifdef HAVE_EXTCAP - /* Extcap */ - constpath = get_extcap_dir(); - - resultArray = g_strsplit(constpath, G_SEARCHPATH_SEPARATOR_S, 10); - for(i = 0; resultArray[i]; i++) - printf("%-21s\t%s\n", "Extcap path:", g_strstrip(resultArray[i])); - - g_strfreev(resultArray); -#endif - } int diff --git a/ui/gtk/about_dlg.c b/ui/gtk/about_dlg.c index 18b1dc5f14..1db3bba6e8 100644 --- a/ui/gtk/about_dlg.c +++ b/ui/gtk/about_dlg.c @@ -458,14 +458,36 @@ about_folders_page_new(void) about_folders_row(table, "Program", constpath, "program files"); -#if defined(HAVE_PLUGINS) || defined(HAVE_LUA) +#ifdef HAVE_PLUGINS + /* pers plugins */ + about_folders_row(table, "Personal Plugins", get_plugins_pers_dir_with_version(), + "binary plugins"); + + /* global plugins */ + about_folders_row(table, "Global Plugins", get_plugins_dir_with_version(), + "binary plugins"); +#endif + +#ifdef HAVE_LUA /* pers plugins */ - about_folders_row(table, "Personal Plugins", get_plugins_pers_dir(), - "dissector plugins"); + about_folders_row(table, "Personal Lua Plugins", get_plugins_pers_dir(), + "lua scripts"); /* global plugins */ - about_folders_row(table, "Global Plugins", get_plugins_dir(), - "dissector plugins"); + about_folders_row(table, "Global Lua Plugins", get_plugins_dir(), + "lua scripts"); +#endif + +#ifdef HAVE_EXTCAP + /* extcap */ + constpath = get_extcap_dir(); + + resultArray = g_strsplit(constpath, G_SEARCHPATH_SEPARATOR_S, 10); + + for(i = 0; resultArray[i]; i++) + about_folders_row(table, "Extcap path", g_strstrip(resultArray[i]), + "Extcap Plugins search path"); + g_strfreev(resultArray); #endif #ifdef HAVE_GEOIP @@ -494,18 +516,6 @@ about_folders_page_new(void) g_free(path); #endif -#ifdef HAVE_EXTCAP - /* extcap */ - constpath = get_extcap_dir(); - - resultArray = g_strsplit(constpath, G_SEARCHPATH_SEPARATOR_S, 10); - - for(i = 0; resultArray[i]; i++) - about_folders_row(table, "Extcap path", g_strstrip(resultArray[i]), - "Extcap Plugins search path"); - g_strfreev(resultArray); -#endif - gtk_container_add(GTK_CONTAINER(scrolledwindow), table); return scrolledwindow; diff --git a/ui/qt/about_dialog.cpp b/ui/qt/about_dialog.cpp index ed48c66a75..c48d727ab5 100644 --- a/ui/qt/about_dialog.cpp +++ b/ui/qt/about_dialog.cpp @@ -224,12 +224,33 @@ AboutDialog::AboutDialog(QWidget *parent) : /* program */ message += about_folders_row("Program", get_progfile_dir(), "program files"); -#if defined(HAVE_PLUGINS) || defined(HAVE_LUA) +#ifdef HAVE_PLUGINS /* pers plugins */ - message += about_folders_row("Personal Plugins", get_plugins_pers_dir(), "dissector plugins"); + message += about_folders_row("Personal Plugins", get_plugins_pers_dir_with_version(), "binary plugins"); /* global plugins */ - message += about_folders_row("Global Plugins", get_plugins_dir(), "dissector plugins"); + message += about_folders_row("Global Plugins", get_plugins_dir_with_version(), "binary plugins"); +#endif + +#ifdef HAVE_LUA + /* pers plugins */ + message += about_folders_row("Personal Lua Plugins", get_plugins_pers_dir(), "lua scripts"); + + /* global plugins */ + message += about_folders_row("Global Lua Plugins", get_plugins_dir(), "lua scripts"); +#endif + +#ifdef HAVE_EXTCAP + /* Extcap */ + constpath = get_extcap_dir(); + + resultArray = g_strsplit(constpath, G_SEARCHPATH_SEPARATOR_S, 10); + + for(i = 0; resultArray[i]; i++) { + message += about_folders_row("Extcap path", g_strstrip(resultArray[i]), + "Extcap Plugins search path"); + } + g_strfreev(resultArray); #endif #ifdef HAVE_GEOIP @@ -260,19 +281,6 @@ AboutDialog::AboutDialog(QWidget *parent) : g_free(path); #endif -#ifdef HAVE_EXTCAP - /* Extcap */ - constpath = get_extcap_dir(); - - resultArray = g_strsplit(constpath, G_SEARCHPATH_SEPARATOR_S, 10); - - for(i = 0; resultArray[i]; i++) { - message += about_folders_row("Extcap path", g_strstrip(resultArray[i]), - "Extcap Plugins search path"); - } - g_strfreev(resultArray); -#endif - message += "</table>"; ui->label_folders->setText(message); 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); diff --git a/wsutil/filesystem.h b/wsutil/filesystem.h index 9357a437ad..18f6f19913 100644 --- a/wsutil/filesystem.h +++ b/wsutil/filesystem.h @@ -56,11 +56,21 @@ WS_DLL_PUBLIC const char *get_progfile_dir(void); WS_DLL_PUBLIC const char *get_plugins_dir(void); /* + * Append VERSION_MAJOR.VERSION_MINOR to the plugin dir. + */ +WS_DLL_PUBLIC const char *get_plugins_dir_with_version(void); + +/* * Get the personal plugin dir. */ WS_DLL_PUBLIC const char *get_plugins_pers_dir(void); /* + * Append VERSION_MAJOR.VERSION_MINOR to the plugin personal dir. + */ +WS_DLL_PUBLIC const char *get_plugins_pers_dir_with_version(void); + +/* * Get the directory in which extcap hooks are stored; this must not be called * before init_progfile_dir() is called, as they might be stored in a * subdirectory of the program file directory. diff --git a/wsutil/plugins.c b/wsutil/plugins.c index 6febafbf07..479b8b7c23 100644 --- a/wsutil/plugins.c +++ b/wsutil/plugins.c @@ -341,10 +341,7 @@ scan_plugins(plugin_load_failure_mode mode) } else { - plugin_dir_path = g_strdup_printf("%s" G_DIR_SEPARATOR_S "%d.%d", - get_plugins_dir(), VERSION_MAJOR, VERSION_MINOR); - plugins_scan_dir(plugin_dir_path, mode); - g_free(plugin_dir_path); + plugins_scan_dir(get_plugins_dir_with_version(), mode); } /* @@ -357,10 +354,7 @@ scan_plugins(plugin_load_failure_mode mode) */ if (!started_with_special_privs()) { - plugin_dir_path = g_strdup_printf("%s" G_DIR_SEPARATOR_S "%d.%d", - get_plugins_pers_dir(), VERSION_MAJOR, VERSION_MINOR); - plugins_scan_dir(plugin_dir_path, mode); - g_free(plugin_dir_path); + plugins_scan_dir(get_plugins_pers_dir_with_version(), mode); } } } |