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

[or-cvs] Make windows fall back to CWD if SHGetSpecialFolderLocation...



Update of /home/or/cvsroot/src/or
In directory moria.mit.edu:/tmp/cvs-serv10762/src/or

Modified Files:
	config.c 
Log Message:
Make windows fall back to CWD if SHGetSpecialFolderLocation is borked

Index: config.c
===================================================================
RCS file: /home/or/cvsroot/src/or/config.c,v
retrieving revision 1.182
retrieving revision 1.183
diff -u -d -r1.182 -r1.183
--- config.c	19 Oct 2004 17:46:06 -0000	1.182
+++ config.c	24 Oct 2004 00:52:10 -0000	1.183
@@ -538,7 +538,10 @@
    */
   if (!SUCCEEDED(SHGetSpecialFolderLocation(NULL, CSIDL_APPDATA,
                                             &idl))) {
-    return NULL;
+    GetCurrentDirectory(MAX_PATH, path);
+    is_set = 1;
+    log_fn(LOG_WARN, "I couldn't find your application data folder: are you running an ancient version of Windows 95? Defaulting to '%s'", path);
+    return path;
   }
   /* Convert the path from an "ID List" (whatever that is!) to a path. */
   result = SHGetPathFromIDList(idl, path);
@@ -551,6 +554,7 @@
   if (!SUCCEEDED(result)) {
     return NULL;
   }
+  strlcat(p,"\\tor",MAX_PATH);
   is_set = 1;
   return path;
 }
@@ -562,7 +566,7 @@
 #ifdef MS_WINDOWS
   char *path = tor_malloc(MAX_PATH);
   strlcpy(path, get_windows_conf_root(), MAX_PATH);
-  strlcat(path,"\\tor\\torrc",MAX_PATH);
+  strlcat(path,"\\torrc",MAX_PATH);
   return path;
 #else
   return tor_strdup(CONFDIR "/torrc");
@@ -1199,7 +1203,6 @@
     char *p;
     p = tor_malloc(MAX_PATH);
     strlcpy(p,get_windows_conf_root(),MAX_PATH);
-    strlcat(p,"\\tor",MAX_PATH);
     options->DataDirectory = p;
     return p;
 #else