Download command does not follow redirects on Windows


#1

I have a package that needs to download a library from sourceforge. On windows, the download command does not follow redirects. I found that the microsoft function that is used by Julia is not able to follow redirects. Is there any other ways to download from sourceforge on windows?
Here’s the code that works on Linux, but not on windows:

download("https://sourceforge.net/projects/coolprop/files/CoolProp/6.1.0/shared_library/Windows/64bit/libCoolProp.dll/download", "libcoolprop.dll")

#2

Can you get curl for Windows? I think that can do redirects. I think I had to use curl for my PhilipsHue hack.


#3

I think it’s generally agreed that we need to improve the download implementation on Windows, but nobody has done the work yet. See this link (and linked URLs): https://github.com/JuliaPackaging/WinRPM.jl/issues/40


#4

Thank you for your help. I use curl until a better solution is found.

readall(`curl -L -o libcoolprop.dll https://sourceforge.net/projects/coolprop/files/CoolProp/6.1.0/shared_library/Windows/64bit/libCoolProp.dll`)

#5

Note that it’s a lot less likely for a curl executable to be installed and on the path for users on Windows, so this will not be very reliable. You can try BinDeps.download_cmd which uses powershell, which is always installed on Windows.


#6

Thank you Tony. You are right. The curl command did not work on my windows machine. Now I use the following and it works fine:

lib_coolprop_path=joinpath(Pkg.dir(), "CoolProp", "deps", "libCoolProp.dll")
lib_coolprop_win_url="https://sourceforge.net/projects/coolprop/files/CoolProp/6.1.0/shared_library/Windows/64bit/libCoolProp.dll/download"
readall(BinDeps.download_cmd(lib_coolprop_win_url, lib_coolprop_path))