Skip to content

Commit 1af767d

Browse files
authored
add safe_copy_directory()
1 parent cc78327 commit 1af767d

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

platform.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,15 @@ def safe_copy_file(src: str, dst: str) -> bool:
142142
return True
143143

144144

145+
@safe_file_operation
146+
def safe_copy_directory(src: str, dst: str) -> bool:
147+
"""Safely copy directories with error handling."""
148+
os.makedirs(os.path.dirname(dst), exist_ok=True)
149+
shutil.copytree(src, dst, dirs_exist_ok=True)
150+
logger.debug(f"Directory copied: {src} -> {dst}")
151+
return True
152+
153+
145154
class Espressif32Platform(PlatformBase):
146155
"""ESP32 platform implementation for PlatformIO with optimized toolchain management."""
147156

0 commit comments

Comments
 (0)