1
0
Fork 0
mirror of https://github.com/alacritty/alacritty.git synced 2024-11-18 13:55:23 -05:00

build(package): acquire latest winpty

This commit is contained in:
OJ Kwon 2018-10-16 21:52:28 -07:00 committed by Zac Pullar-Strecker
parent 9bc888fbe5
commit f3a76e24f1

View file

@ -37,7 +37,7 @@ use std::io;
use std::fs::OpenOptions; use std::fs::OpenOptions;
#[cfg(windows)] #[cfg(windows)]
const WINPTY_PACKAGE_URL: &str = "https://www.nuget.org/api/v2/package/winpty.NET/0.4.2"; const WINPTY_PACKAGE_URL: &str = "https://github.com/rprichard/winpty/releases/download/0.4.3/winpty-0.4.3-msvc2015.zip";
fn main() { fn main() {
let dest = env::var("OUT_DIR").unwrap(); let dest = env::var("OUT_DIR").unwrap();
@ -68,6 +68,7 @@ fn main() {
fn aquire_winpty_agent(out_path: &Path) { fn aquire_winpty_agent(out_path: &Path) {
let tmp_dir = TempDir::new("alacritty_build").unwrap(); let tmp_dir = TempDir::new("alacritty_build").unwrap();
let mut response = reqwest::get(WINPTY_PACKAGE_URL).unwrap(); let mut response = reqwest::get(WINPTY_PACKAGE_URL).unwrap();
let mut file = OpenOptions::new() let mut file = OpenOptions::new()
.read(true) .read(true)
@ -80,12 +81,12 @@ fn aquire_winpty_agent(out_path: &Path) {
let mut archive = zip::ZipArchive::new(file).unwrap(); let mut archive = zip::ZipArchive::new(file).unwrap();
let target = match env::var("TARGET").unwrap().split("-").next().unwrap() { let target = match env::var("TARGET").unwrap().split("-").next().unwrap() {
"x86_64" => "x86", "x86_64" => "x64",
"i386" => "x64", "i386" => "ia32",
_ => panic!("architecture has no winpty binary") _ => panic!("architecture has no winpty binary")
}; };
let mut winpty_agent = archive.by_name(&format!("content/winpty/{}/winpty-agent.exe", target)).unwrap(); let mut winpty_agent = archive.by_name(&format!("{}/bin/winpty-agent.exe", target)).unwrap();
io::copy(&mut winpty_agent, &mut File::create(out_path).unwrap()).unwrap(); io::copy(&mut winpty_agent, &mut File::create(out_path).unwrap()).unwrap();
} }