Allow an alternate application data location as specified by the new environment...
authorcmaynard <cmaynard@f5534014-38df-0310-8fa8-9805f1628bb7>
Fri, 13 Sep 2013 20:15:46 +0000 (20:15 +0000)
committercmaynard <cmaynard@f5534014-38df-0310-8fa8-9805f1628bb7>
Fri, 13 Sep 2013 20:15:46 +0000 (20:15 +0000)
See also: http://www.wireshark.org/lists/wireshark-users/201309/msg00013.html

git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@52022 f5534014-38df-0310-8fa8-9805f1628bb7

doc/wireshark.pod.template
epan/filesystem.c

index 28e1ebfc3105433b9e529cff26eabfdb063b23d0..8c5365d6b8d38ee2698e9d881648955011f8ea89 100644 (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
index d7764b589f176060c578be68b5a641d7937f5af7..dd5b308beedf46c8e7862ac4e2720ab563b4a1a4 100644 (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