Skip to content
This repository has been archived by the owner on Apr 21, 2023. It is now read-only.

Commit

Permalink
Switch to OS agnostic library for getting username
Browse files Browse the repository at this point in the history
Previous one did not support Windows
  • Loading branch information
GeckoEidechse committed Sep 5, 2022
1 parent b1b5bdf commit 45242fe
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 30 deletions.
18 changes: 7 additions & 11 deletions 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 Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ anyhow = "1.0"
# Find steam games
steamlocate = "1.0.2"
# Get current user username
users = "0.11.0"
whoami = "0.9.0"

[profile.release]
opt-level = 2 # fast and small wasm
24 changes: 6 additions & 18 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,24 +27,12 @@ fn main() {
}

let mut native_options = eframe::NativeOptions::default();
match users::get_current_username() {
Some(username) => {
println!("Username {:?}", username);
match username.to_str() {
Some(username) => {
println!("{}", username);
if username == "deck" {
// Run in fullscreen if user is Steam Deck (or just called `deck`)
native_options.maximized = true;
}
}
None => println!("Couldn't convert OS string"),
};
}
None => {
println!("Failed to get current user username");
}
};

// Run in fullscreen if user is Steam Deck (or just called `deck`)
// in the future, this should check for more Steam Deck specific settings
if whoami::username() == "deck" {
native_options.maximized = true;
}

eframe::run_native(
"northstar_dev_testing_helper_tool",
Expand Down

0 comments on commit 45242fe

Please sign in to comment.