Skip to content

Commit

Permalink
Fix zip
Browse files Browse the repository at this point in the history
  • Loading branch information
kLabz committed Apr 19, 2024
1 parent 3c6c6a5 commit f82b949
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
Binary file modified build/download.hxb
Binary file not shown.
Binary file modified build/select.hxb
Binary file not shown.
12 changes: 6 additions & 6 deletions src/HaxeDownload.hx
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,14 @@ class HaxeDownload {
final path = Path.join([Utils.releasesDir, filename]);

DownloadHelper.download(url + filename, path, () -> {
trace('Downloaded $filename as $alias');
Sys.println('Downloaded $filename');
final out = DownloadHelper.extract(path);
FileSystem.deleteFile(path);

final versionPath = Path.join([Utils.versionsDir, alias]);
try FileSystem.deleteFile(versionPath) catch(_) {}
FileSync.symlink(Path.join([FileSystem.absolutePath(Utils.releasesDir), out]), versionPath);
trace('Done');
Sys.println('Installed $filename as $alias');
});
}

Expand Down Expand Up @@ -110,7 +110,7 @@ class DownloadHelper {
public static function extract(path:String):Null<String> {
final pathData = new Path(path);
final filename = pathData.file + (pathData.ext == null ? "" : "." + pathData.ext);
trace('Extracting $filename...');
Sys.println('Extracting $filename...');

return switch (Path.extension(filename)) {
case "zip": new ZipExtractor(File.read(path, true)).extract(pathData.dir);
Expand Down Expand Up @@ -154,7 +154,7 @@ class TarExtractor extends format.tar.Reader {

if (FileSystem.exists(path)) {
// TODO: allow overwriting
trace('Output already exists; skipping');
Sys.println('Output already exists; skipping');
return ret;
}
}
Expand Down Expand Up @@ -205,15 +205,15 @@ class ZipExtractor {

if (FileSystem.exists(path)) {
// TODO: allow overwriting
trace('Output already exists; skipping');
Sys.println('Output already exists; skipping');
return ret;
}
}

FileSystem.createDirectory(path);
} else {
final out = File.write(path, true);
out.writeBytes(e.data, 0, e.fileSize);
out.writeBytes(haxe.zip.Reader.unzip(e), 0, e.fileSize);
out.close();
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/Utils.hx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ function getReleaseUrl(v:String):Array<String> {
case "Mac":
['https://github.com/HaxeFoundation/haxe/releases/download/$v/', 'haxe-$v-osx.tar.gz'];
case "Windows":
['https://github.com/HaxeFoundation/haxe/releases/download/$v/', 'haxe-$v-windows64.zip'];
['https://github.com/HaxeFoundation/haxe/releases/download/$v/', 'haxe-$v-win64.zip'];
case os: throw 'OS $os is not supported (yet)';
}
}
Expand Down

0 comments on commit f82b949

Please sign in to comment.