[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

PATCH: support local application data paths by default via configure option --enable-local-appdata



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).
diff -Naur orig-tor/configure.in mod-tor/configure.in
--- orig-tor/configure.in	2009-01-07 21:05:02.433428000 +0000
+++ mod-tor/configure.in	2009-01-15 22:32:40.208956064 +0000
@@ -96,6 +96,13 @@
 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
diff -Naur orig-tor/src/or/config.c mod-tor/src/or/config.c
--- orig-tor/src/or/config.c	2009-01-07 21:13:02.443406000 +0000
+++ mod-tor/src/or/config.c	2009-01-15 22:35:36.250193728 +0000
@@ -3735,8 +3735,11 @@
   /* 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
+  if (!SUCCEEDED(SHGetSpecialFolderLocation(NULL, CSIDL_LOCAL_APPDATA, &idl))) {
+#else
+  if (!SUCCEEDED(SHGetSpecialFolderLocation(NULL, CSIDL_APPDATA, &idl))) {
+#endif
     GetCurrentDirectory(MAX_PATH, path);
     is_set = 1;
     log_warn(LD_CONFIG,