Browse Source

This patch changes the default location where config and data files
are stored when the --enable-local-appdata option is configured. This
changes the Windows path from %APPDATA% to a host local
%USERPROFILE%\Local Settings\Application Data\ path (aka,
LOCAL_APPDATA).

Patch from coderman.



svn:r18122

Nick Mathewson 15 years ago
parent
commit
87124f54d0
3 changed files with 17 additions and 2 deletions
  1. 4 0
      ChangeLog
  2. 7 0
      configure.in
  3. 6 2
      src/or/config.c

+ 4 - 0
ChangeLog

@@ -12,6 +12,10 @@ Changes in version 0.2.1.11-alpha - 2009-01-??
       897 and others.
     - Make setting ServerDNSRandomizeCase to 0 actually work.  Bugfix
       for bug 905.  Bugfix on 0.2.1.7-alpha.
+    - Add a new --enable-local-appdata configuration switch to change
+      the default location of the datadir on win32 from APPDATA to
+      LOCAL_APPDATA.  In the future, we should migrate entirely.  Patch
+      from coderman.
 
   o Minor bugfixes:
     - Make outbound DNS packets respect the OutboundBindAddress setting.

+ 7 - 0
configure.in

@@ -96,6 +96,13 @@ fi
 AC_ARG_ENABLE(gcc-warnings,
      AS_HELP_STRING(--enable-gcc-warnings, enable verbose warnings))
 
+AC_ARG_ENABLE(local-appdata,
+   AS_HELP_STRING(--enable-local-appdata, default to host local application data paths on Windows))
+if test "$enable_local_appdata" = "yes"; then
+  AC_DEFINE(ENABLE_LOCAL_APPDATA, 1,
+            [Defined if we default to host local appdata paths on Windows])
+fi
+
 AC_PROG_CC
 AC_PROG_CPP
 AC_PROG_MAKE_SET

+ 6 - 2
src/or/config.c

@@ -3735,8 +3735,12 @@ get_windows_conf_root(void)
   /* Find X:\documents and settings\username\application data\ .
    * We would use SHGetSpecialFolder path, but that wasn't added until IE4.
    */
-  if (!SUCCEEDED(SHGetSpecialFolderLocation(NULL, CSIDL_APPDATA,
-                                            &idl))) {
+#ifdef ENABLE_LOCAL_APPDATA
+#define APPDATA_PATH CSIDL_LOCAL_APPDATA
+#else
+#define APPDATA_PATH CSIDL_APPDATA
+#endif
+  if (!SUCCEEDED(SHGetSpecialFolderLocation(NULL, APPDATA_PATH, &idl))) {
     GetCurrentDirectory(MAX_PATH, path);
     is_set = 1;
     log_warn(LD_CONFIG,