MCPcopy Create free account
hub / github.com/JaredStewart/coderlm / _remove_dir_if_empty

Function _remove_dir_if_empty

plugin/generate.py:289–301  ·  view source on GitHub ↗
(path: Path, dry_run: bool)

Source from the content-addressed store, hash-verified

287
288
289def _remove_dir_if_empty(path: Path, dry_run: bool) -> None:
290 if not path.exists() or not path.is_dir():
291 return
292 try:
293 if any(path.iterdir()):
294 return
295 except PermissionError:
296 return
297 if dry_run:
298 print(f" [dry-run] rmdir {path}")
299 return
300 path.rmdir()
301 print(f" Removed empty directory {path}")
302
303
304# -- CLI --

Callers 1

clean_platformFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected