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
This commit is contained in:
Chris Maynard 2013-09-13 20:15:46 +00:00
parent e078770856
commit 02cec4d51b
2 changed files with 20 additions and 5 deletions

View File

@ -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

View File

@ -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;
@ -1331,15 +1331,24 @@ get_persconffile_dir_no_profile(void)
return persconffile_dir;
#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