Skip to content

Commit

Permalink
No longer create temporary directories (close #320)
Browse files Browse the repository at this point in the history
  • Loading branch information
AcidWeb committed Jan 1, 2022
1 parent 737f5ba commit 1a8cb60
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions CB/GitHub.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,9 @@ def get_addon(self):
self.archive = zipfile.ZipFile(io.BytesIO(requests.get(self.downloadUrl, headers=self.headers, timeout=5).content))

def install(self, path):
self.archive.extractall(path)
for directory in self.directories:
shutil.rmtree(path / directory, ignore_errors=True)
shutil.move(path / f'{self.shorthPath}-{self.branch}' / directory, path)
shutil.rmtree(path / f'{self.shorthPath}-{self.branch}')
for file in self.archive.infolist():
file.filename = file.filename.replace(f'{self.shorthPath}-{self.branch}/', '')
if any(f in file.filename for f in self.directories):
self.archive.extract(file, path)

0 comments on commit 1a8cb60

Please sign in to comment.