Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Release::asset_for ability to find asset by current OS and ARCH #123

Merged
merged 2 commits into from
Apr 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
- `Release::asset_for` now searches for current `OS` and `ARCH` inside `asset.name` if `target` failed to match
- Update `reqwest` to `0.12.0`
- Update `hyper` to `1.2.0`
### Removed
Expand Down
12 changes: 7 additions & 5 deletions src/update.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use reqwest::{self, header};
use std::env::consts::{ARCH, OS};
use std::fs;
use std::path::PathBuf;

Expand Down Expand Up @@ -62,11 +63,12 @@ impl Release {
.iter()
.find(|asset| {
asset.name.contains(target)
&& if let Some(i) = identifier {
asset.name.contains(i)
} else {
true
}
|| (asset.name.contains(OS) && asset.name.contains(ARCH))
&& if let Some(i) = identifier {
asset.name.contains(i)
} else {
true
}
})
.cloned()
}
Expand Down