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

Commit 45242fe

Browse files
committed
Switch to OS agnostic library for getting username
Previous one did not support Windows
1 parent b1b5bdf commit 45242fe

3 files changed

Lines changed: 14 additions & 30 deletions

File tree

Cargo.lock

Lines changed: 7 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ anyhow = "1.0"
3030
# Find steam games
3131
steamlocate = "1.0.2"
3232
# Get current user username
33-
users = "0.11.0"
33+
whoami = "0.9.0"
3434

3535
[profile.release]
3636
opt-level = 2 # fast and small wasm

src/main.rs

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -27,24 +27,12 @@ fn main() {
2727
}
2828

2929
let mut native_options = eframe::NativeOptions::default();
30-
match users::get_current_username() {
31-
Some(username) => {
32-
println!("Username {:?}", username);
33-
match username.to_str() {
34-
Some(username) => {
35-
println!("{}", username);
36-
if username == "deck" {
37-
// Run in fullscreen if user is Steam Deck (or just called `deck`)
38-
native_options.maximized = true;
39-
}
40-
}
41-
None => println!("Couldn't convert OS string"),
42-
};
43-
}
44-
None => {
45-
println!("Failed to get current user username");
46-
}
47-
};
30+
31+
// Run in fullscreen if user is Steam Deck (or just called `deck`)
32+
// in the future, this should check for more Steam Deck specific settings
33+
if whoami::username() == "deck" {
34+
native_options.maximized = true;
35+
}
4836

4937
eframe::run_native(
5038
"northstar_dev_testing_helper_tool",

0 commit comments

Comments
 (0)