simplify directories: electrum_dir
This commit is contained in:
parent
8774f1a193
commit
48efc62b2d
2
electrum
2
electrum
|
@ -107,7 +107,6 @@ if __name__ == '__main__':
|
||||||
util.check_windows_wallet_migration()
|
util.check_windows_wallet_migration()
|
||||||
|
|
||||||
config = SimpleConfig(config_options)
|
config = SimpleConfig(config_options)
|
||||||
storage = WalletStorage(config)
|
|
||||||
|
|
||||||
if len(args)==0:
|
if len(args)==0:
|
||||||
url = None
|
url = None
|
||||||
|
@ -149,6 +148,7 @@ if __name__ == '__main__':
|
||||||
|
|
||||||
|
|
||||||
# instanciate wallet for command-line
|
# instanciate wallet for command-line
|
||||||
|
storage = WalletStorage(config)
|
||||||
wallet = Wallet(storage)
|
wallet = Wallet(storage)
|
||||||
|
|
||||||
if cmd not in known_commands:
|
if cmd not in known_commands:
|
||||||
|
|
|
@ -177,8 +177,6 @@ class InstallWizard(QDialog):
|
||||||
self.config.set_key("server", None, True)
|
self.config.set_key("server", None, True)
|
||||||
self.config.set_key('auto_cycle', False, True)
|
self.config.set_key('auto_cycle', False, True)
|
||||||
|
|
||||||
#self.interface.start(wait = False)
|
|
||||||
|
|
||||||
# generate the first addresses, in case we are offline
|
# generate the first addresses, in case we are offline
|
||||||
if s is None or a == 'create':
|
if s is None or a == 'create':
|
||||||
wallet.synchronize()
|
wallet.synchronize()
|
||||||
|
|
|
@ -230,9 +230,7 @@ class BlockchainVerifier(threading.Thread):
|
||||||
return rev_hex(Hash(self.header_to_string(header).decode('hex')).encode('hex'))
|
return rev_hex(Hash(self.header_to_string(header).decode('hex')).encode('hex'))
|
||||||
|
|
||||||
def path(self):
|
def path(self):
|
||||||
wdir = self.config.get('blockchain_headers_path', user_dir())
|
return os.path.join( self.config.path, 'blockchain_headers')
|
||||||
if wdir and not os.path.exists( wdir ): os.mkdir(wdir)
|
|
||||||
return os.path.join( wdir, 'blockchain_headers')
|
|
||||||
|
|
||||||
def init_headers_file(self):
|
def init_headers_file(self):
|
||||||
filename = self.path()
|
filename = self.path()
|
||||||
|
@ -327,3 +325,5 @@ class BlockchainVerifier(threading.Thread):
|
||||||
new_bits = c + MM * i
|
new_bits = c + MM * i
|
||||||
return new_bits, new_target
|
return new_bits, new_target
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -20,11 +20,15 @@ a SimpleConfig instance then reads the wallet file.
|
||||||
|
|
||||||
# system conf, readonly
|
# system conf, readonly
|
||||||
self.system_config = {}
|
self.system_config = {}
|
||||||
if options.get('portable') == False:
|
if options.get('portable') is not True:
|
||||||
self.read_system_config()
|
self.read_system_config()
|
||||||
|
|
||||||
|
# read path
|
||||||
|
self.path = self.system_config.get('electrum_path')
|
||||||
|
if self.path is None:
|
||||||
|
self.path = user_dir()
|
||||||
|
|
||||||
# user conf, writeable
|
# user conf, writeable
|
||||||
self.user_dir = user_dir()
|
|
||||||
self.user_config = {}
|
self.user_config = {}
|
||||||
if options.get('portable') == False:
|
if options.get('portable') == False:
|
||||||
self.read_user_config()
|
self.read_user_config()
|
||||||
|
@ -33,17 +37,17 @@ a SimpleConfig instance then reads the wallet file.
|
||||||
self.options_config = options
|
self.options_config = options
|
||||||
|
|
||||||
# init path
|
# init path
|
||||||
self.init_path(options)
|
self.init_path()
|
||||||
|
|
||||||
print_error( "user dir", self.user_dir)
|
print_error( "electrum path", self.path)
|
||||||
|
|
||||||
|
|
||||||
def init_path(self, options):
|
def init_path(self):
|
||||||
|
|
||||||
# Look for wallet file in the default data directory.
|
# Look for wallet file in the default data directory.
|
||||||
# Make wallet directory if it does not yet exist.
|
# Make wallet directory if it does not yet exist.
|
||||||
if not os.path.exists(self.user_dir):
|
if not os.path.exists(self.path):
|
||||||
os.mkdir(self.user_dir)
|
os.mkdir(self.path)
|
||||||
|
|
||||||
|
|
||||||
# portable wallet: use the same directory for wallet and headers file
|
# portable wallet: use the same directory for wallet and headers file
|
||||||
|
@ -130,9 +134,9 @@ a SimpleConfig instance then reads the wallet file.
|
||||||
|
|
||||||
def read_user_config(self):
|
def read_user_config(self):
|
||||||
"""Parse and store the user config settings in electrum.conf into user_config[]."""
|
"""Parse and store the user config settings in electrum.conf into user_config[]."""
|
||||||
if not self.user_dir: return
|
if not self.path: return
|
||||||
|
|
||||||
path = os.path.join(self.user_dir, "config")
|
path = os.path.join(self.path, "config")
|
||||||
if os.path.exists(path):
|
if os.path.exists(path):
|
||||||
try:
|
try:
|
||||||
with open(path, "r") as f:
|
with open(path, "r") as f:
|
||||||
|
@ -148,9 +152,9 @@ a SimpleConfig instance then reads the wallet file.
|
||||||
|
|
||||||
|
|
||||||
def save_user_config(self):
|
def save_user_config(self):
|
||||||
if not self.user_dir: return
|
if not self.path: return
|
||||||
|
|
||||||
path = os.path.join(self.user_dir, "config")
|
path = os.path.join(self.path, "config")
|
||||||
s = repr(self.user_config)
|
s = repr(self.user_config)
|
||||||
f = open(path,"w")
|
f = open(path,"w")
|
||||||
f.write( s )
|
f.write( s )
|
||||||
|
|
Loading…
Reference in New Issue