Fix wallet write to support windows
This commit is contained in:
parent
80513745d5
commit
21673c95f4
|
@ -135,15 +135,18 @@ class WalletStorage(object):
|
||||||
|
|
||||||
def write(self):
|
def write(self):
|
||||||
assert not threading.currentThread().isDaemon()
|
assert not threading.currentThread().isDaemon()
|
||||||
|
temp_path = self.path + '.tmp'
|
||||||
s = json.dumps(self.data, indent=4, sort_keys=True)
|
s = json.dumps(self.data, indent=4, sort_keys=True)
|
||||||
with open(self.path + '.tmp', "w") as f:
|
with open(temp_path, "w") as f:
|
||||||
f.write(s)
|
f.write(s)
|
||||||
os.rename(self.path + '.tmp', self.path)
|
os.remove(self.path)
|
||||||
|
os.rename(temp_path, self.path)
|
||||||
if 'ANDROID_DATA' not in os.environ:
|
if 'ANDROID_DATA' not in os.environ:
|
||||||
import stat
|
import stat
|
||||||
os.chmod(self.path,stat.S_IREAD | stat.S_IWRITE)
|
os.chmod(self.path,stat.S_IREAD | stat.S_IWRITE)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class Abstract_Wallet(object):
|
class Abstract_Wallet(object):
|
||||||
"""
|
"""
|
||||||
Wallet classes are created to handle various address generation methods.
|
Wallet classes are created to handle various address generation methods.
|
||||||
|
|
Loading…
Reference in New Issue