Skip to content

Commit

Permalink
Rename gzipfile to archive_file.
Browse files Browse the repository at this point in the history
  • Loading branch information
azriel91 committed Nov 29, 2024
1 parent 95c5ce8 commit d06d9dd
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,23 +162,23 @@ def install_or_update(cls) -> None:
is_windows = sublime.platform() == "windows"
extension = "zip" if is_windows else "gz"
url = URL.format(tag=TAG, arch=arch(), platform=platform(), ext=extension)
gzipfile = os.path.join(cls.basedir(), f"rust-analyzer.{extension}")
archive_file = os.path.join(cls.basedir(), f"rust-analyzer.{extension}")
serverfile = os.path.join(
cls.basedir(),
"rust-analyzer.exe" if is_windows else "rust-analyzer"
)
with urllib.request.urlopen(url) as fp:
with open(gzipfile, "wb") as f:
with open(archive_file, "wb") as f:
f.write(fp.read())

if is_windows:
with zipfile.ZipFile(gzipfile, "r") as zip_ref:
with zipfile.ZipFile(archive_file, "r") as zip_ref:
zip_ref.extract("rust-analyzer.exe", cls.basedir())
else:
with gzip.open(gzipfile, "rb") as fp:
with gzip.open(archive_file, "rb") as fp:
with open(serverfile, "wb") as f:
f.write(fp.read())
os.remove(gzipfile)
os.remove(archive_file)
os.chmod(serverfile, 0o744)
with open(os.path.join(cls.basedir(), "VERSION"), "w") as fp:
fp.write(version)
Expand Down

0 comments on commit d06d9dd

Please sign in to comment.