File tree Expand file tree Collapse file tree 3 files changed +9
-10
lines changed
Expand file tree Collapse file tree 3 files changed +9
-10
lines changed Original file line number Diff line number Diff line change 33from pathlib import Path
44from gi .repository import GLib , Gio
55from savedesktop .globals import *
6- from savedesktop .core .password_store import PasswordStore
76
87# Get the current date
98dt = datetime .now ()
@@ -33,9 +32,10 @@ def run(self, now: bool) -> None:
3332 self .pbfolder = f'{ settings ["periodic-saving-folder" ].format (download_dir )} '
3433
3534 if now :
36- print ("Saving immediately " )
35+ print ("MODE: Save now " )
3736 self .backup ()
3837 else :
38+ print ("MODE: Periodic saving" )
3939 self .get_interval ()
4040
4141 # Get the periodic saving interval from GSettings
@@ -58,7 +58,7 @@ def check_and_backup(self, interval):
5858 print (f"Backup not needed today. Last backup was on { self .last_backup_date } ." )
5959
6060 def backup (self ):
61- if self .pbfolder == f'{ download_dir } /SaveDesktop/archives' :
61+ if self .pbfolder == '{}/SaveDesktop/archives' . format ( download_dir ) or self . pbfolder == f'{ download_dir } /SaveDesktop/archives' :
6262 try :
6363 if not os .path .exists (f"{ download_dir } /SaveDesktop/archives" ):
6464 os .makedirs (f"{ download_dir } /SaveDesktop/archives" )
@@ -72,7 +72,6 @@ def backup(self):
7272 else :
7373 self .filename = settings ["filename-format" ]
7474
75- print ("MODE: Periodic saving" )
7675 self .call_archive_command ()
7776
7877 self .save_last_backup_date ()
Original file line number Diff line number Diff line change @@ -132,9 +132,9 @@ def try_passwordstore():
132132 app .run ([])
133133 self .password = try_passwordstore ()
134134
135- # #3 If password is still unavailable, get it from the {DATA }/entered-password.txt file
136- if not self .password and os .path .exists (f"{ DATA } /entered-password.txt " ):
137- with open (f"{ DATA } /entered-password.txt " ) as ep :
135+ # #3 If password is still unavailable, get it from the {CACHE }/entered-password.txt file
136+ if not self .password and os .path .exists (f"{ CACHE } /temp_file " ):
137+ with open (f"{ CACHE } /temp_file " ) as ep :
138138 self .password = ep .read ().strip ()
139139
140140 # #4 Final check
@@ -159,8 +159,8 @@ def done(self):
159159 with open (f"{ DATA } /sync-info.json" , "w" ) as s :
160160 json .dump ({"last-synced" : date .today ().isoformat ()}, s )
161161
162- if os .path .exists (f"{ DATA } /entered-password.txt " ):
163- os .remove (f"{ DATA } /entered-password.txt " )
162+ if os .path .exists (f"{ CACHE } /temp_file " ):
163+ os .remove (f"{ CACHE } /temp_file " )
164164
165165 # Send a notification about finished synchronization
166166 os .system (f"notify-send 'Save Desktop Synchronization ({ self .file } )' '{ _ ('The configuration has been applied!' )} { _ ('Changes will only take effect after the next login' )} ' -i io.github.vikdevelop.SaveDesktop-symbolic" )
Original file line number Diff line number Diff line change @@ -77,7 +77,7 @@ def save_password(self, w):
7777 if self .remSwitch .get_active ():
7878 PasswordStore (self .passEntry .get_text ())
7979 else :
80- with open (f"{ DATA } /entered-password.txt " , "w" ) as ep :
80+ with open (f"{ CACHE } /temp_file " , "w" ) as ep :
8181 ep .write (self .passEntry .get_text ())
8282 self .close ()
8383
You can’t perform that action at this time.
0 commit comments