summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2004-10-24 00:52:10 +0000
committerNick Mathewson <nickm@torproject.org>2004-10-24 00:52:10 +0000
commit78a2c3aa3973a745a1742b4cd0a5cb99f650cdf0 (patch)
tree282e47c3f59ecb9547b134234729979fbca7da47 /src
parent54c432bd93542875d54dd019ac0f4f5cb390d853 (diff)
downloadtor-78a2c3aa3973a745a1742b4cd0a5cb99f650cdf0.tar.gz
tor-78a2c3aa3973a745a1742b4cd0a5cb99f650cdf0.zip
Make windows fall back to CWD if SHGetSpecialFolderLocation is borked
svn:r2578
Diffstat (limited to 'src')
-rw-r--r--src/or/config.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/or/config.c b/src/or/config.c
index 0e475db5ef..a43fadaf4f 100644
--- a/src/or/config.c
+++ b/src/or/config.c
@@ -538,7 +538,10 @@ static char *get_windows_conf_root(void)
*/
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 @@ static char *get_windows_conf_root(void)
if (!SUCCEEDED(result)) {
return NULL;
}
+ strlcat(p,"\\tor",MAX_PATH);
is_set = 1;
return path;
}
@@ -562,7 +566,7 @@ get_default_conf_file(void)
#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 @@ get_data_directory(or_options_t *options)
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