Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
death7654 committed Oct 5, 2023
2 parents 100c077 + 5d10edb commit 423c23f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/github-actions-demo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,9 @@ jobs:
- name: Linux AppImage Packaging
if: matrix.platform == 'ubuntu-20.04'
run: ./linux_build.sh
- name: Upload build artifacts
uses: actions/upload-artifact@v3
with:
name: Chrultrabook-Controller
retention-days: 5
path: src-tauri/target/release/bundle/appimage/*.AppImage
16 changes: 10 additions & 6 deletions src-tauri/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -205,19 +205,23 @@ async fn get_cpu_cores() -> String {

#[tauri::command]
async fn get_cpu_name() -> String {
let cmd: Result<std::process::Output, std::io::Error>;

#[cfg(target_os = "linux")]
{
cmd = std::process::Command::new("lscpu")
.args(["--parse=MODELNAME"])
.output();
return match_result(cmd).split('\n').collect::<Vec<_>>()[4].to_string();
let mut cpuname = "";
let cpuinfo = fs::read_to_string("/proc/cpuinfo").unwrap();
for line in cpuinfo.split("\n").collect::<Vec<_>>() {
if line.starts_with("model name") {
cpuname = line.split(":").collect::<Vec<_>>()[1].trim();
break;
}
}
return String::from(cpuname);
}

#[cfg(windows)]
{
cmd = std::process::Command::new("wmic")
let cmd = std::process::Command::new("wmic")
.creation_flags(0x08000000)
.args(["cpu", "get", "name"])
.output();
Expand Down

0 comments on commit 423c23f

Please sign in to comment.