Skip to content

Commit

Permalink
paths arent strings
Browse files Browse the repository at this point in the history
  • Loading branch information
mcspr committed Jun 19, 2024
1 parent cc5d5c1 commit 632d985
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions tools/get.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import shutil
import errno
import os.path
import pathlib
import hashlib
import json
import platform
Expand Down Expand Up @@ -65,17 +66,19 @@ def unpack_impl(filename, destination):
if file:
file.close()

return dirname
return pathlib.Path(destination) / dirname

def unpack(name, filename, destination):
expected = pathlib.Path(destination) / name

print(f'Extracting {filename}')
dirname = unpack_impl(filename, destination)
output = unpack_impl(filename, destination)

if dirname != name:
print(f'Renaming {dirname} to {name}')
if os.path.isdir(name):
shutil.rmtree(name)
shutil.move(dirname, name)
if expected != output:
print(f'Renaming {output} to {expected}')
if expected.is_dir():
shutil.rmtree(expected)
output.rename(expected)

def get_tool(name, tool):
archive_name = tool['archiveFileName']
Expand Down

0 comments on commit 632d985

Please sign in to comment.