Fix wallet write to support windows

This commit is contained in:
Maran 2015-04-24 13:14:17 +02:00
parent 80513745d5
commit 21673c95f4
1 changed files with 5 additions and 2 deletions

View File

@ -135,15 +135,18 @@ class WalletStorage(object):
def write(self):
assert not threading.currentThread().isDaemon()
temp_path = self.path + '.tmp'
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)
os.rename(self.path + '.tmp', self.path)
os.remove(self.path)
os.rename(temp_path, self.path)
if 'ANDROID_DATA' not in os.environ:
import stat
os.chmod(self.path,stat.S_IREAD | stat.S_IWRITE)
class Abstract_Wallet(object):
"""
Wallet classes are created to handle various address generation methods.