Skip to content

Commit

Permalink
chore: more to osinfo crate instead of sysinfo as it gived user frien…
Browse files Browse the repository at this point in the history
…dly os names
  • Loading branch information
abose committed Jul 29, 2024
1 parent 4c6f92c commit b75620e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 30 deletions.
12 changes: 1 addition & 11 deletions src-tauri/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ tauri-build = { version = "1.5.1", features = [] }
[dependencies]
reqwest = { version = "0.11", features = ["json"] }
tokio = { version = "1.0", features = ["full"] }
sys-info = "0.9.1"
os_info = "3"
chrono = "0.4"
serde_json = "1.0.116"
once_cell = "1.19.0"
Expand Down
23 changes: 5 additions & 18 deletions src-tauri/src/bugsnag.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ use serde_json::to_string_pretty;
use std::collections::HashMap;
use reqwest::header::{HeaderMap, CONTENT_TYPE};
use tokio::runtime::Runtime;
extern crate sys_info;
extern crate chrono;
use chrono::prelude::*;
use std::fs::File;
Expand Down Expand Up @@ -218,22 +217,11 @@ fn get_linux_flavor() -> io::Result<String> {
}

fn get_sysinfo() -> (String, String, String, String) {
let os_type = sys_info::os_type().unwrap_or_else(|_| "Unknown OS".to_string());
let mut os_release = sys_info::os_release().unwrap_or_else(|_| "Unknown Version".to_string());

#[cfg(target_os = "linux")]
{
// Get the Linux flavor like ubuntu/fedora/arch etc.. too as part of version in Linux
if let Ok(flavor) = get_linux_flavor() {
os_release = format!("{} {}", flavor, os_release);
}
}

let info = os_info::get();
let os_type = info.os_type().to_string();
let os_release = info.version().to_string();

// Get the machine architecture using the standard library
let arch = std::env::consts::ARCH.to_string();

// Get the name of the current executable
let arch = info.architecture().unwrap_or("unknown").to_string();
let exe_path = env::args().next().unwrap_or_else(|| "Unknown Executable".to_string());
let exe_name = Path::new(&exe_path)
.file_name()
Expand All @@ -244,7 +232,6 @@ fn get_sysinfo() -> (String, String, String, String) {
(os_type, os_release, arch, exe_name)
}


pub fn handle(message: &String){
let mut result: Vec<JsonFrame> = Vec::new();
backtrace::trace(|frame| {
Expand Down Expand Up @@ -290,7 +277,7 @@ pub fn handle(message: &String){
os_name: os_type.to_string(),
os_version: os_version.to_string(),
time: current_time.to_string(),
cpu_abi: vec!["x86_64".to_string()],
cpu_abi: vec![arch.to_string()],
runtime_versions: HashMap::new(),
},
session: HashMap::new(),
Expand Down

0 comments on commit b75620e

Please sign in to comment.