Skip to content
This repository has been archived by the owner on Apr 2, 2021. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
ecdsa authored and a-bezrukov committed Feb 14, 2019
1 parent 09cd2e5 commit 42b2d5c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions electrum/storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ def __init__(self, path):
self.db_lock = threading.RLock()
self.data = {}
self.path = os.path.normcase(os.path.abspath(path))
self._file_exists = self.path and os.path.exists(self.path)
self.modified = False

def get(self, key, default=None):
Expand Down Expand Up @@ -135,17 +136,18 @@ def _write(self):
f.flush()
os.fsync(f.fileno())

mode = os.stat(self.path).st_mode if os.path.exists(self.path) else stat.S_IREAD | stat.S_IWRITE
mode = os.stat(self.path).st_mode if self.file_exists() else stat.S_IREAD | stat.S_IWRITE
os.replace(temp_path, self.path)
os.chmod(self.path, mode)
self._file_exists = True
self.print_error("saved", self.path)
self.modified = False

def encrypt_before_writing(self, plaintext: str) -> str:
return plaintext

def file_exists(self):
return self.path and os.path.exists(self.path)
return self._file_exists


class WalletStorage(JsonDB):
Expand Down

0 comments on commit 42b2d5c

Please sign in to comment.