Skip to content

Commit

Permalink
Change output directory of Config::download
Browse files Browse the repository at this point in the history
  • Loading branch information
termoshtt committed Jun 15, 2020
1 parent 265fc61 commit 96b7756
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
4 changes: 2 additions & 2 deletions intel-mkl-tool/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,15 @@ 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!(
"Download archive {:<22} into {}",
cfg.name(),
path.display()
);
cfg.download(&path)?;
cfg.download(&path.join(cfg.name()))?;
}
}
}
Expand Down
7 changes: 2 additions & 5 deletions intel-mkl-tool/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 96b7756

Please sign in to comment.