Skip to content

Commit

Permalink
Save backup files in the home directory to survive reboots
Browse files Browse the repository at this point in the history
  • Loading branch information
EarToEarOak committed Dec 2, 2014
1 parent 627fd5f commit c002a6b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
10 changes: 7 additions & 3 deletions src/file.py
Expand Up @@ -201,15 +201,19 @@ class Backups(object):
PREFIX = 'rsba_'

def __init__(self):
self.homeDir = os.path.expanduser('~')
self.homeDir = os.path.join(self.homeDir, '.rtlsdr_scanner')
if not os.path.exists(self.homeDir):
os.mkdir(self.homeDir)
self.thread = None
self.backup = None
self.tempFd, self.tempFile = tempfile.mkstemp(prefix=self.PREFIX)
self.tempFd, self.tempFile = tempfile.mkstemp(prefix=self.PREFIX,
dir=self.homeDir)
self.backups = self.__get()

def __get(self):
files = []
tempDir = tempfile.gettempdir()
backups = glob.glob(tempDir + '/' + self.PREFIX + '*')
backups = glob.glob(self.homeDir + '/' + self.PREFIX + '*')
backups.remove(self.tempFile)

for backup in backups:
Expand Down
2 changes: 1 addition & 1 deletion src/version-timestamp
@@ -1 +1 @@
1417468454
1417538803

0 comments on commit c002a6b

Please sign in to comment.