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 @@ -128,6 +128,14 @@ class InWarmupError(JSONRPCError):
128128 RPC_ERROR_CODE = - 28
129129
130130
131+ def default_btc_dir ():
132+ if platform .system () == 'Darwin' :
133+ return os .path .expanduser ('~/Library/Application Support/Bitcoin/' )
134+ elif platform .system () == 'Windows' :
135+ return os .path .join (os .environ ['APPDATA' ], 'Bitcoin' )
136+ return os .path .expanduser ('~/.bitcoin' )
137+
138+
131139class BaseProxy (object ):
132140 """Base JSON-RPC proxy class. Contains only private methods; do not use
133141 directly."""
@@ -148,13 +156,7 @@ def __init__(self,
148156 if service_url is None :
149157 # Figure out the path to the bitcoin.conf file
150158 if btc_conf_file is None :
151- if platform .system () == 'Darwin' :
152- btc_conf_file = os .path .expanduser ('~/Library/Application Support/Bitcoin/' )
153- elif platform .system () == 'Windows' :
154- btc_conf_file = os .path .join (os .environ ['APPDATA' ], 'Bitcoin' )
155- else :
156- btc_conf_file = os .path .expanduser ('~/.bitcoin' )
157- btc_conf_file = os .path .join (btc_conf_file , 'bitcoin.conf' )
159+ btc_conf_file = os .path .join (default_btc_dir (), 'bitcoin.conf' )
158160
159161 # Bitcoin Core accepts empty rpcuser, not specified in btc_conf_file
160162 conf = {'rpcuser' : "" }
You can’t perform that action at this time.
0 commit comments