Better error handling for #982

This commit is contained in:
bobokun 2025-11-24 13:54:14 -05:00
parent 946e653717
commit 94efd542ac
No known key found for this signature in database
GPG key ID: B73932169607D927
3 changed files with 16 additions and 9 deletions

View file

@ -1 +1 @@
4.6.5-develop4
4.6.5-develop5

View file

@ -871,15 +871,16 @@ class Config:
"""
# Assign directories
if "directory" in self.data:
self.root_dir = os.path.join(
self.util.check_for_attribute(self.data, "root_dir", parent="directory", default_is_none=True), ""
)
self.remote_dir = os.path.join(
self.util.check_for_attribute(
self.data, "remote_dir", parent="directory", default=self.root_dir, do_print=False, save=False
),
"",
root_dir = self.util.check_for_attribute(self.data, "root_dir", parent="directory", default_is_none=True)
if isinstance(root_dir, list):
root_dir = root_dir[0]
self.root_dir = os.path.join(root_dir, "")
remote_dir = self.util.check_for_attribute(
self.data, "remote_dir", parent="directory", default=self.root_dir, do_print=False, save=False
)
if isinstance(remote_dir, list):
remote_dir = remote_dir[0]
self.remote_dir = os.path.join(remote_dir, "")
if self.commands["tag_nohardlinks"] or self.commands["rem_orphaned"]:
self.remote_dir = self.util.check_for_attribute(
self.data,

View file

@ -1390,6 +1390,12 @@ def path_replace(path, old_path, new_path):
return path
# Normalize all paths to use forward slashes for comparison
if isinstance(path, list):
path = path[0]
if isinstance(old_path, list):
old_path = old_path[0]
if isinstance(new_path, list):
new_path = new_path[0]
path_norm = path.replace("\\", "/")
old_norm = old_path.replace("\\", "/")
new_norm = new_path.replace("\\", "/") if new_path else ""