Skip to content

Commit

Permalink
Merge pull request #66 from t-mw/patch-2
Browse files Browse the repository at this point in the history
Apply windows exe suffix to bin_name on s3 backend
  • Loading branch information
jaemk authored Feb 19, 2021
2 parents 6197d67 + 83e04b8 commit 192c0c1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## [unreleased]
### Added
### Changed
- `UpdateBuilder.bin_name` will add the platform-specific exe suffix on the S3 backend.
### Removed

## [0.23.0]
Expand Down
7 changes: 4 additions & 3 deletions src/backends/s3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use quick_xml::events::Event;
use quick_xml::Reader;
use regex::Regex;
use std::cmp::Ordering;
use std::env;
use std::env::{self, consts::EXE_SUFFIX};
use std::path::{Path, PathBuf};

/// Maximum number of items to retrieve from S3 API
Expand Down Expand Up @@ -237,9 +237,10 @@ impl UpdateBuilder {

/// Set the exe's name. Also sets `bin_path_in_archive` if it hasn't already been set.
pub fn bin_name(&mut self, name: &str) -> &mut Self {
self.bin_name = Some(name.to_owned());
let raw_bin_name = format!("{}{}", name.trim_end_matches(EXE_SUFFIX), EXE_SUFFIX);
self.bin_name = Some(raw_bin_name.clone());
if self.bin_path_in_archive.is_none() {
self.bin_path_in_archive = Some(PathBuf::from(name));
self.bin_path_in_archive = Some(PathBuf::from(raw_bin_name));
}
self
}
Expand Down

0 comments on commit 192c0c1

Please sign in to comment.