Fix Windows compatibility issues

This commit is contained in:
thePR0M3TH3AN
2025-07-05 13:15:13 -04:00
parent 9e1880c3c7
commit 14354ca4e3
4 changed files with 16 additions and 4 deletions

View File

@@ -76,6 +76,7 @@ class BackupManager:
backup_file = self.backup_dir / backup_filename
shutil.copy2(index_file, backup_file)
os.chmod(backup_file, 0o600)
logger.info(f"Backup created successfully at '{backup_file}'.")
print(colored(f"Backup created successfully at '{backup_file}'.", "green"))
@@ -95,6 +96,7 @@ class BackupManager:
dest_dir.mkdir(parents=True, exist_ok=True)
dest_file = dest_dir / f"{self.fingerprint_dir.name}_{backup_file.name}"
shutil.copy2(backup_file, dest_file)
os.chmod(dest_file, 0o600)
logger.info(f"Additional backup created at '{dest_file}'.")
except Exception as e: # pragma: no cover - best-effort logging
logger.error(
@@ -118,6 +120,7 @@ class BackupManager:
latest_backup = backup_files[0]
index_file = self.index_file
shutil.copy2(latest_backup, index_file)
os.chmod(index_file, 0o600)
logger.info(f"Restored the index file from backup '{latest_backup}'.")
print(
colored(
@@ -173,6 +176,7 @@ class BackupManager:
) as dst:
fh_src.seek(0)
shutil.copyfileobj(fh_src, dst)
os.chmod(self.index_file, 0o600)
logger.info(f"Restored the index file from backup '{backup_file}'.")
print(
colored(