summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Maynard <Christopher.Maynard@GTECH.COM>2013-09-13 20:15:46 +0000
committerChris Maynard <Christopher.Maynard@GTECH.COM>2013-09-13 20:15:46 +0000
commit02cec4d51b57cfda2636131e89b3b80e4223a881 (patch)
tree774f55fadb90020d961852d9755aa8dbf578777f
parente078770856ec918cbd828bd7fa2c005b00dd8e10 (diff)
downloadwireshark-02cec4d51b57cfda2636131e89b3b80e4223a881.tar.gz
Allow an alternate application data location as specified by the new environment variable, WIRESHARK_APPDATA (chosen instead of my originally proposed WS_APPDATA name since most other Wireshark-specific environment variables were already named with the WIRESHARK_ prefix).
See also: http://www.wireshark.org/lists/wireshark-users/201309/msg00013.html svn path=/trunk/; revision=52022
-rw-r--r--doc/wireshark.pod.template6
-rw-r--r--epan/filesystem.c19
2 files changed, 20 insertions, 5 deletions
diff --git a/doc/wireshark.pod.template b/doc/wireshark.pod.template
index 28e1ebfc31..8c5365d6b8 100644
--- a/doc/wireshark.pod.template
+++ b/doc/wireshark.pod.template
@@ -2718,6 +2718,12 @@ See above in the description of the About:Plugins page.
=over 4
+=item WIRESHARK_APPDATA
+
+On Windows, Wireshark normally stores all application data in %APPDATA% or
+%USERPROFILE%. You can override the default location by exporting this
+environment variable to specify an alternate location.
+
=item WIRESHARK_DEBUG_EP_NO_CHUNKS
Normally per-packet memory is allocated in large "chunks." This behavior
diff --git a/epan/filesystem.c b/epan/filesystem.c
index d7764b589f..dd5b308bee 100644
--- a/epan/filesystem.c
+++ b/epan/filesystem.c
@@ -307,7 +307,7 @@ static char *progfile_dir;
*/
static char *appbundle_dir;
#endif
-
+
/*
* TRUE if we're running from the build directory and we aren't running
* with special privileges.
@@ -1320,7 +1320,7 @@ get_persconffile_dir_no_profile(void)
#ifdef _WIN32
char *appdatadir;
char *userprofiledir;
- char *u3appdatapath;
+ char *altappdatapath;
#else
const char *homedir;
struct passwd *pwd;
@@ -1332,14 +1332,23 @@ get_persconffile_dir_no_profile(void)
#ifdef _WIN32
/*
+ * See if the user has selected an alternate environment.
+ */
+ altappdatapath = getenv_utf8("WIRESHARK_APPDATA");
+ if (altappdatapath != NULL) {
+ persconffile_dir = altappdatapath;
+ return persconffile_dir;
+ }
+
+ /*
* See if we are running in a U3 environment.
*/
- u3appdatapath = getenv_utf8("U3_APP_DATA_PATH");
- if (u3appdatapath != NULL) {
+ altappdatapath = getenv_utf8("U3_APP_DATA_PATH");
+ if (altappdatapath != NULL) {
/*
* We are; use the U3 application data path.
*/
- persconffile_dir = u3appdatapath;
+ persconffile_dir = altappdatapath;
} else {
/*
* Use %APPDATA% or %USERPROFILE%, so that configuration