Skip to content

Commit

Permalink
Fix not deleting auto-created classes folder
Browse files Browse the repository at this point in the history
If you are using `bAltDirectories=True` now script will clean up generated `Classes` folder.
  • Loading branch information
Shtoyan committed Mar 23, 2023
1 parent dbec48e commit fb27b3a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion Compile.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,9 +200,14 @@ def cleanup_files() -> None:
safe_delete_file(r.path_garbage_file)
safe_delete_file(r.path_compilation_ini)

# remove folder with all sources from compile directory
if r.bICompileOutsideofKF:
safe_delete_dir(r.path_compile_dir.joinpath(r.mutatorName))

# remove classes folder, we use alternative file organization method
if r.bAltDirectories:
safe_delete_dir(r.path_compile_dir.joinpath(r.mutatorName).joinpath("Classes"))


# https://docs.python.org/3/library/shutil.html#rmtree-example
def remove_readonly(func: Any, path: Any, _: Any) -> None:
Expand All @@ -212,7 +217,7 @@ def remove_readonly(func: Any, path: Any, _: Any) -> None:


def safe_delete_dir(input_path: Path) -> None:
"""remove new created 'classes' folder on alternate dir style"""
"""safe delete directories"""
if input_path.exists():
shutil.rmtree(input_path, onerror=remove_readonly)

Expand Down

0 comments on commit fb27b3a

Please sign in to comment.