mirror of
https://github.com/ZDoom/zdoom-macos-deps.git
synced 2024-11-10 14:41:43 +00:00
aedi: remove empty directories in prefix
This commit is contained in:
parent
0028ca3545
commit
2989630d79
1 changed files with 20 additions and 0 deletions
|
@ -270,6 +270,26 @@ class Builder(object):
|
|||
# Do symlink cleanup only once
|
||||
cleanup = False
|
||||
|
||||
Builder._remove_empty_directories(state.prefix_path)
|
||||
|
||||
@staticmethod
|
||||
def _remove_empty_directories(path: Path) -> int:
|
||||
content: typing.List[str] = os.listdir(path)
|
||||
count = len(content)
|
||||
removed = 0
|
||||
|
||||
for entry in content:
|
||||
abspath = path / entry
|
||||
|
||||
if os.path.isdir(abspath):
|
||||
removed += Builder._remove_empty_directories(abspath)
|
||||
|
||||
if count == removed:
|
||||
os.rmdir(path)
|
||||
removed = 1
|
||||
|
||||
return removed
|
||||
|
||||
def _detect_target(self):
|
||||
for name, target in self._targets.items():
|
||||
if target.detect(self._state):
|
||||
|
|
Loading…
Reference in a new issue