Add support for WIRESHARK_EXTCAP_DIR environment variable on Windows

This can be useful when a user cannot modify the Wireshark installation folder (due to UAC restriction for example)
This is already supported on Linux / OSX

Change-Id: Icfcb43908de1fd8cd415cd31a98219eab1c757c8
Reviewed-on: https://code.wireshark.org/review/7809
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
This commit is contained in:
Pascal Quantin 2015-03-24 23:04:57 +01:00 committed by Anders Broman
parent 9a9413f9f4
commit 786a7ea42c
1 changed files with 11 additions and 1 deletions

View File

@ -1057,6 +1057,8 @@ static const char *extcap_dir = NULL;
static void init_extcap_dir(void) {
#ifdef _WIN32
char *alt_extcap_path;
/*
* On Windows, the data file directory is the installation
* directory; the extcap hooks are stored under it.
@ -1065,7 +1067,15 @@ static void init_extcap_dir(void) {
* on Windows, the data file directory is the directory
* in which the Wireshark binary resides.
*/
extcap_dir = g_strdup_printf("%s\\extcap", get_datafile_dir());
alt_extcap_path = getenv_utf8("WIRESHARK_EXTCAP_DIR");
if (alt_extcap_path) {
/*
* The user specified a different directory for extcap hooks.
*/
extcap_dir = g_strdup(alt_extcap_path);
} else {
extcap_dir = g_strdup_printf("%s\\extcap", get_datafile_dir());
}
#else
if (running_in_build_directory_flag) {
/*