diff --git a/pyproject.toml b/pyproject.toml index 007c4d57..0ba17b84 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "hatchling.build" [project] name = "rtgs-lab-tools" -version = "0.2.0" +version = "0.3.0" description = "Environmental sensing data tools, gridded climate data access, and IoT device management for RTGS Lab" authors = [ {name = "RTGS Lab", email = "rtgs@umn.edu"}, diff --git a/src/rtgs_lab_tools/sd_dump/core.py b/src/rtgs_lab_tools/sd_dump/core.py index b242e29d..6ddd87ba 100644 --- a/src/rtgs_lab_tools/sd_dump/core.py +++ b/src/rtgs_lab_tools/sd_dump/core.py @@ -233,15 +233,20 @@ def log(message: str): elif line.startswith("FILE_START:"): parts = line.split(":") full_path = parts[1] + if "System Volume Information" in full_path: + log(f"Sanitizing protected path: {full_path}") + full_path = full_path.replace( + "System Volume Information", "_System Volume Information_" + ) + file_size = int(parts[2]) total_chunks = int(parts[3]) file_num = int(parts[4]) # Create directory structure if needed - file_path = Path(full_path) - if file_path.parts[0] == "/": - # Remove leading slash to make it relative - file_path = Path(*file_path.parts[1:]) + # This robustly removes the leading slash on any OS + relative_path_str = full_path.lstrip("/") + file_path = Path(relative_path_str) output_file_path = output_dir / file_path output_file_path.parent.mkdir(parents=True, exist_ok=True)