Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Benjamin Allred
crown-core
Commits
6551cfa3
Commit
6551cfa3
authored
12 years ago
by
Pieter Wuille
Browse files
Options
Download
Plain Diff
Merge pull request #1133 from sipa/abspath
Make GetDataDir return absolute paths
parents
a5fd7c99
eef6f269
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
src/init.cpp
+2
-1
src/init.cpp
src/qt/bitcoin.cpp
+2
-1
src/qt/bitcoin.cpp
src/util.cpp
+7
-4
src/util.cpp
src/util.h
+1
-1
src/util.h
with
12 additions
and
7 deletions
+12
-7
src/init.cpp
View file @
6551cfa3
...
...
@@ -150,11 +150,12 @@ bool AppInit2(int argc, char* argv[])
// If Qt is used, parameters/bitcoin.conf are parsed in qt/bitcoin.cpp's main()
#if !defined(QT_GUI)
ParseParameters
(
argc
,
argv
);
if
(
!
ReadConfigFile
(
mapArgs
,
mapMultiArgs
))
if
(
!
boost
::
filesystem
::
is_directory
(
GetDataDir
(
false
)
))
{
fprintf
(
stderr
,
"Error: Specified directory does not exist
\n
"
);
Shutdown
(
NULL
);
}
ReadConfigFile
(
mapArgs
,
mapMultiArgs
);
#endif
if
(
mapArgs
.
count
(
"-?"
)
||
mapArgs
.
count
(
"--help"
))
...
...
This diff is collapsed.
Click to expand it.
src/qt/bitcoin.cpp
View file @
6551cfa3
...
...
@@ -168,11 +168,12 @@ int main(int argc, char *argv[])
ParseParameters
(
argc
,
argv
);
// ... then bitcoin.conf:
if
(
!
ReadConfigFile
(
mapArgs
,
mapMultiArgs
))
if
(
!
boost
::
filesystem
::
is_directory
(
GetDataDir
(
false
)
))
{
fprintf
(
stderr
,
"Error: Specified directory does not exist
\n
"
);
return
1
;
}
ReadConfigFile
(
mapArgs
,
mapMultiArgs
);
// Application identification (must be set before OptionsModel is initialized,
// as it is used to locate QSettings)
...
...
This diff is collapsed.
Click to expand it.
src/util.cpp
View file @
6551cfa3
...
...
@@ -870,7 +870,11 @@ const boost::filesystem::path &GetDataDir(bool fNetSpecific)
LOCK
(
csPathCached
);
if
(
mapArgs
.
count
(
"-datadir"
))
{
path
=
mapArgs
[
"-datadir"
];
path
=
fs
::
system_complete
(
mapArgs
[
"-datadir"
]);
if
(
!
fs
::
is_directory
(
path
))
{
path
=
""
;
return
path
;
}
}
else
{
path
=
GetDefaultDataDir
();
}
...
...
@@ -892,7 +896,7 @@ boost::filesystem::path GetConfigFile()
return
pathConfigFile
;
}
bool
ReadConfigFile
(
map
<
string
,
string
>&
mapSettingsRet
,
void
ReadConfigFile
(
map
<
string
,
string
>&
mapSettingsRet
,
map
<
string
,
vector
<
string
>
>&
mapMultiSettingsRet
)
{
namespace
fs
=
boost
::
filesystem
;
...
...
@@ -900,7 +904,7 @@ bool ReadConfigFile(map<string, string>& mapSettingsRet,
fs
::
ifstream
streamConfig
(
GetConfigFile
());
if
(
!
streamConfig
.
good
())
return
true
;
// No bitcoin.conf file is OK
return
;
// No bitcoin.conf file is OK
set
<
string
>
setOptions
;
setOptions
.
insert
(
"*"
);
...
...
@@ -917,7 +921,6 @@ bool ReadConfigFile(map<string, string>& mapSettingsRet,
}
mapMultiSettingsRet
[
strKey
].
push_back
(
it
->
value
[
0
]);
}
return
true
;
}
boost
::
filesystem
::
path
GetPidFile
()
...
...
This diff is collapsed.
Click to expand it.
src/util.h
View file @
6551cfa3
...
...
@@ -162,7 +162,7 @@ const boost::filesystem::path &GetDataDir(bool fNetSpecific = true);
boost
::
filesystem
::
path
GetConfigFile
();
boost
::
filesystem
::
path
GetPidFile
();
void
CreatePidFile
(
const
boost
::
filesystem
::
path
&
path
,
pid_t
pid
);
bool
ReadConfigFile
(
std
::
map
<
std
::
string
,
std
::
string
>&
mapSettingsRet
,
std
::
map
<
std
::
string
,
std
::
vector
<
std
::
string
>
>&
mapMultiSettingsRet
);
void
ReadConfigFile
(
std
::
map
<
std
::
string
,
std
::
string
>&
mapSettingsRet
,
std
::
map
<
std
::
string
,
std
::
vector
<
std
::
string
>
>&
mapMultiSettingsRet
);
bool
GetStartOnSystemStartup
();
bool
SetStartOnSystemStartup
(
bool
fAutoStart
);
void
ShrinkDebugFile
();
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
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
Menu
Projects
Groups
Snippets
Help