Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use 7z.exe from Julia binary download #177

Merged
merged 2 commits into from
Mar 4, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
30 changes: 25 additions & 5 deletions src/AtomShell/install.jl
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,31 @@ function install()
end

if Sys.iswindows()
arch = Int == Int64 ? "x64" : "ia32"
file = "electron-v$version-win32-$arch.zip"
download("https://github.com/electron/electron/releases/download/v$version/$file")
run(`7z x $file -oatom`)
rm(file)
arch = Int == Int64 ? "x64" : "ia32"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any reason you re-indented this section to 3 spaces instead of 2? Can we put it back to make comparing the diff easier?

That said, i'm not sure why the whole file has 2-space indent instead of 4... I've opened #182 to change that, and i can just merge it after your PR is merged! :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No reason! The 2-space indentation was not recognized by my editor, which tries too be a bit smarter than it is.

file = "electron-v$version-win32-$arch.zip"
download("https://github.com/electron/electron/releases/download/v$version/$file")
zipper = joinpath(Base.Sys.BINDIR, "7z.exe")
if !isfile(zipper)
#=
This is likely built with cygwin, which includes its own version of 7z.
But if we unzip with cmd = Cmd(`$(fwhich("bash.exe")) 7z x $file -oatom`)
The resulting files would not be windows executable.
So we want the 7z.exe included with a binary download of Julia.
The PATH environment variable likely includes to the locally built
Julia, so instead we look in the default Julia binary location and
pick the latest version.
=#
juliafolders = filter(readdir(ENV["LOCALAPPDATA"])) do f
startswith(f, "Julia-")
end
juliaversions = VersionNumber.([replace(f, "Julia-" => "") for f in juliafolders])
i = findlast(isequal(maximum(juliaversions)), juliaversions)
zipper = joinpath(ENV["LOCALAPPDATA"], juliafolders[i], "bin", "7z.exe")
isfile(zipper) || error("could not find $zipper. Try also installing a binary version of Julia.")
hustf marked this conversation as resolved.
Show resolved Hide resolved
end
cmd = Cmd([zipper, "x", file, "-oatom"])
run(cmd)
rm(file)
end

if Sys.islinux()
Expand Down