Skip to content

Commit 4d1fa3d

Browse files
committed
Fix a bug with updating home path in dconf-settings.ini and code cleanup
1 parent cc9a33b commit 4d1fa3d

File tree

4 files changed

+13
-9
lines changed

4 files changed

+13
-9
lines changed

src/core/archive.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ def _create_archive(self):
7373
cmd.insert(5, f"-p{password}")
7474

7575
proc = subprocess.run(cmd, capture_output=True, text=True)
76+
print(proc.stdout)
7677

7778
if proc.returncode not in (0, 1):
7879
# 0 = everything is OK, 1 = warning (e.g. file not found)
@@ -134,18 +135,20 @@ def _unpack_zip_archive(self):
134135
raise ValueError(first_error or "Wrong password")
135136
print("Checking password is completed.")
136137

137-
subprocess.run(
138+
cmd = subprocess.run(
138139
['7z', 'x', '-y', f'-p{password}', self.import_file, f'-o{TEMP_CACHE}'],
139-
capture_output=False, text=True, check=True
140+
capture_output=True, text=True, check=True
140141
)
142+
print(cmd.stdout)
141143

142144
# Unpack a legacy archive with Tarball (for backward compatibility)
143145
def _unpack_tar_archive(self):
144-
subprocess.run(["tar", "-xzf", self.import_file, "-C", f"{TEMP_CACHE}"],capture_output=True, text=True, check=True)
146+
cmd = subprocess.run(["tar", "-xzf", self.import_file, "-C", f"{TEMP_CACHE}"],capture_output=True, text=True, check=True)
147+
print(cmd.stdout)
145148

146149
# Replace original /home/$USER path with actual path in the dconf-settings.ini file and other XML files
147150
def _replace_home_in_files(self, root, home, patterns=(".xml", ".ini")):
148-
regex = re.compile(r"/home/[^/]+/")
151+
regex = re.compile(r"(?:/var)?/home/[^/]+/")
149152
for dirpath, _, filenames in os.walk(root):
150153
for filename in filenames:
151154
if filename.endswith(patterns):

src/core/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ def __init__(self):
213213
# Create an autostart file to install Flatpaks from a list after the next login
214214
def create_flatpak_autostart(self):
215215
os.system(f"cp /app/share/savedesktop/savedesktop/core/flatpaks_installer.py {CACHE}/")
216-
if not os.path.exists(f"{DATA}/savedesktop-synchronization.sh") or not os.path.exists(f"{CACHE}/syncing/sync_status"):
216+
if not os.path.exists(f"{DATA}/savedesktop-synchronization.sh"):
217217
if not os.path.exists(f"{home}/.config/autostart"):
218218
os.mkdir(f"{home}/.config/autostart")
219219
if not os.path.exists(f"{home}/.config/autostart/io.github.vikdevelop.SaveDesktop.Flatpak.desktop"):

src/core/synchronization.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -158,9 +158,6 @@ def done(self):
158158
if not settings["manually-sync"]:
159159
with open(f"{DATA}/sync-info.json", "w") as s:
160160
json.dump({"last-synced": date.today().isoformat()}, s)
161-
162-
if os.path.exists(f"{CACHE}/temp_file"):
163-
os.remove(f"{CACHE}/temp_file")
164161

165162
# Send a notification about finished synchronization
166163
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")

src/gui/window.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -585,7 +585,8 @@ def _identify_file_type(self):
585585

586586
def _call_archive_command(self):
587587
try:
588-
subprocess.run([sys.executable, "-m", "savedesktop.core.archive", self.archive_mode, self.archive_name], check=True, capture_output=True, text=True, env={**os.environ, "PYTHONPATH": f"{app_prefix}"})
588+
cmd = subprocess.run([sys.executable, "-m", "savedesktop.core.archive", self.archive_mode, self.archive_name], check=True, capture_output=True, text=True, env={**os.environ, "PYTHONPATH": f"{app_prefix}"})
589+
print(cmd.stdout)
589590
except subprocess.CalledProcessError as err:
590591
e = err.stderr
591592
GLib.idle_add(self.show_err_msg, e)
@@ -753,3 +754,6 @@ def on_close(self, w):
753754
settings["window-size"] = self.get_default_size()
754755
settings["maximized"] = self.is_maximized()
755756
settings["filename"] = self.saveEntry.get_text()
757+
758+
if os.path.exists(f"{CACHE}/expand_pb_row"):
759+
os.remove(f"{CACHE}/expand_pb_row")

0 commit comments

Comments
 (0)