File tree Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -115,6 +115,14 @@ class InWarmupError(JSONRPCError):
115115 RPC_ERROR_CODE = - 28
116116
117117
118+ def default_btc_dir ():
119+ if platform .system () == 'Darwin' :
120+ return os .path .expanduser ('~/Library/Application Support/Bitcoin/' )
121+ elif platform .system () == 'Windows' :
122+ return os .path .join (os .environ ['APPDATA' ], 'Bitcoin' )
123+ return os .path .expanduser ('~/.bitcoin' )
124+
125+
118126class BaseProxy (object ):
119127 """Base JSON-RPC proxy class. Contains only private methods; do not use
120128 directly."""
@@ -135,13 +143,7 @@ def __init__(self,
135143 if service_url is None :
136144 # Figure out the path to the bitcoin.conf file
137145 if btc_conf_file is None :
138- if platform .system () == 'Darwin' :
139- btc_conf_file = os .path .expanduser ('~/Library/Application Support/Bitcoin/' )
140- elif platform .system () == 'Windows' :
141- btc_conf_file = os .path .join (os .environ ['APPDATA' ], 'Bitcoin' )
142- else :
143- btc_conf_file = os .path .expanduser ('~/.bitcoin' )
144- btc_conf_file = os .path .join (btc_conf_file , 'bitcoin.conf' )
146+ btc_conf_file = os .path .join (default_btc_dir (), 'bitcoin.conf' )
145147
146148 # Bitcoin Core accepts empty rpcuser, not specified in btc_conf_file
147149 conf = {'rpcuser' : "" }
You can’t perform that action at this time.
0 commit comments