Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Mike Perry
Tor
Commits
6d1e1b7f
Commit
6d1e1b7f
authored
Oct 17, 2004
by
Nick Mathewson
⛰
Browse files
Unify windows special-dir handling
svn:r2552
parent
376d483d
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/or/config.c
View file @
6d1e1b7f
...
...
@@ -520,20 +520,24 @@ init_options(or_options_t *options)
options
->
NumCpus
=
1
;
}
static
char
*
get_default_conf_file
(
void
)
{
#ifdef MS_WINDOWS
static
char
*
get_windows_conf_root
(
void
)
{
static
int
is_set
=
0
;
static
char
path
[
MAX_PATH
+
1
];
LPITEMIDLIST
idl
;
IMalloc
*
m
;
HRESULT
result
;
char
*
path
=
tor_malloc
(
MAX_PATH
);
if
(
is_set
)
return
path
;
/* Find X:\documents and settings\username\applicatation data\ .
* We would use SHGetSpecialFolder path, but that wasn't added until IE4.
*/
if
(
!
SUCCEEDED
(
SHGetSpecialFolderLocation
(
NULL
,
CSIDL_APPDATA
,
&
idl
)))
{
tor_free
(
path
);
return
NULL
;
}
/* Convert the path from an "ID List" (whatever that is!) to a path. */
...
...
@@ -545,9 +549,19 @@ get_default_conf_file(void)
m
->
lpVtbl
->
Release
(
m
);
}
if
(
!
SUCCEEDED
(
result
))
{
tor_free
(
path
);
return
NULL
;
}
is_set
=
1
;
return
path
;
}
#endif
static
char
*
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
);
return
path
;
#else
...
...
@@ -1178,9 +1192,7 @@ get_data_directory(or_options_t *options)
#ifdef MS_WINDOWS
char
*
p
;
p
=
tor_malloc
(
MAX_PATH
);
if
(
!
SUCCEEDED
(
SHGetSpecialFolderPath
(
NULL
,
p
,
CSIDL_APPDATA
,
1
)))
{
strlcpy
(
p
,
CONFDIR
,
MAX_PATH
);
}
strlcpy
(
p
,
get_windows_conf_root
(),
MAX_PATH
);
strlcat
(
p
,
"
\\
tor"
,
MAX_PATH
);
options
->
DataDirectory
=
p
;
return
p
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment