INNER CODE UNIT · Python
verify_nautical_mounted_source_location
Minituff/nautical-backup · app/backup.py:119
def verify_nautical_mounted_source_location(self, src_dir: str):
self.log_this(f"Verifying source directory '{src_dir}'...", "DEBUG", LogType.INIT)
if not os.path.isdir(src_dir):
self.log_this(f"Source directory '{src_dir}' does not exist.", "ERROR", LogType.INIT)
raise FileNotFoundError(f"Source directory '{src_dir}' does not exist.")
elif not os.access(src_dir, os.R_OK):
self.log_this(f"No read access to source directory '{src_dir}'.", "ERROR", LogType.INIT)
raise PermissionError(f"No read access to source directory '{src_dir}'")
self.log_this(f"Source directory '{src_dir}' READ access verified", "TRACE", LogType.INIT)
def verify_nautical_mounted_destination_location(self, dest_dir: Union[str, Path], create_if_not_exists=True):
self.log_this(f"Verifying Nautical destination directory '{dest_dir}'...", "DEBUG", LogType.INIT)
if not os.path.exists(dest_dir) and create_if_not_exists:
os.makedirs(dest_dir, exist_ok=True)
if not os.path.isdir(dest_dir):