diff --git a/intel-mkl-tool/src/cli.rs b/intel-mkl-tool/src/cli.rs index e780d354..fdbab9e1 100644 --- a/intel-mkl-tool/src/cli.rs +++ b/intel-mkl-tool/src/cli.rs @@ -44,7 +44,7 @@ fn main() -> Result<()> { let path = path.unwrap_or(xdg_home_path()); if let Some(name) = name { let cfg = Config::from_str(&name)?; - cfg.download(&path)?; + cfg.download(&path.join(cfg.name()))?; } else { for cfg in Config::possible() { info!( @@ -52,7 +52,7 @@ fn main() -> Result<()> { cfg.name(), path.display() ); - cfg.download(&path)?; + cfg.download(&path.join(cfg.name()))?; } } } diff --git a/intel-mkl-tool/src/config.rs b/intel-mkl-tool/src/config.rs index b41fd32c..39e2eebc 100644 --- a/intel-mkl-tool/src/config.rs +++ b/intel-mkl-tool/src/config.rs @@ -119,14 +119,11 @@ impl Config { libs } - /// Download archive from AWS S3, and expand into `${out_dir}/${self.name()}/*.so` + /// Download archive from AWS S3, and expand into `${out_dir}/*.so` pub fn download(&self, out_dir: &Path) -> Result<()> { - let out_dir = out_dir.join(self.name()); if out_dir.exists() { - bail!("Already exists: {}", out_dir.display()); + fs::create_dir_all(&out_dir)?; } - fs::create_dir_all(&out_dir)?; - let data = read_from_url(&format!("{}/{}.tar.zst", s3_addr(), self.name()))?; let zstd = zstd::stream::read::Decoder::new(data.as_slice())?; let mut arc = tar::Archive::new(zstd);