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

2 add os detection and associated errors #12

Merged
merged 4 commits into from
May 10, 2024
Merged
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
10 changes: 9 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,14 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
}

let info = os_info::get();

// Check that we are only running on Linux
if &info.os_type().to_string() == "Windows" {
panic!("Running on Windows. Will only work on Linux.")
} else if &info.os_type().to_string() == "Mac OS" {
panic!("Running on Mac. Will only work on Linux.")
}

let zip_urls: Vec<String> = get_latest_release_zip_urls()?.into_iter().collect();
// Get the correct url for this architecture
let url = get_matching_url(&zip_urls, &info)?;
Expand All @@ -287,7 +295,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
let zip_dir = tempdir()?;
std::fs::create_dir_all(zip_dir.path())?;
// Download the file
let zip_file_path = download_zip(url, &zip_dir.path())?;
let zip_file_path = download_zip(url, zip_dir.path())?;

println!("Downloaded successfully!");

Expand Down
Loading