Multiplatform Dev #52
No reviewers
Labels
No labels
???
bug
docs
enhancement
help wanted
indev
question
research
tbr
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: NG-SD-Plugins/PowerTools#52
Loading…
Reference in a new issue
No description provided.
Delete branch "dev"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This took me way longer than I'm willing to admit. Feedback is appreciated.
This would be better if it didn't crash the whole backend when
home()
returns None (which can happen, especially when gamescope isn't running). You can use.unwrap_or()
or.unwrap_or_else()
to provide a fallback value, or use.expect("error message")
to crash with an explanation as to what went wrong.Since you've got a PathBuf, why not use it's built-in path building functionality (
.join()
) instead of converting it into a string and then using my crappyformat!()
path building? This may require a minor refactor of surrounding code, but it would be cleaner.See other comment about using unwrap()
I think expect("error") would be best as the framework relies on gamescope currently. It might be best to consider the first logged in user as the expected user instead of using the gamescope PID. That will make it more robust at least, gamescope isn't required for steam to run, and the new gamepadui is available in the regular client now.
I've previously used the bash cmd
who
to identify this. Might be worth looking into.Fair points. Try out usdpl-back v0.7.2, that removes the gamescope user check and uses
who
instead. It still doesn't change that it can return None, but it's now unlikely and weird enough that I think it's fine to useexpect()
since PowerTools should clearly not be run in that funky situation.JSYK,
usdpl_back::api::dirs::home()
now only returns None when no user with a/home/<user>
dir is currently logged in.Updated the PR but have a new issue. It works, but I get this warning when compiling:
Any advice on solving this error?
I was not able to use .expect how I expected as PathBuf doesn't have that method implemented. I think using /tmp for settings and logs in an error state could be useful so I left it as that.
Changed.
Changed
Removed
The copy should have .unwrap() or .expect("error message") chained on it. That one is fine to crash because it's only in debug builds and if that copy fails you've got bigger problems than PowerTools crashing.
Is there anything else left to add to this PR, or is it good to merge?
All requested changes made. This version runs on my Aya Neo 2021. Ready for merge after review.
Found an error in release compiling, I should have checked that before. The #[cfg(not(debug_assertions))] on 26 causes a compile issue. Need to change it to
let log_filepath = std::path::PathBuf::from(r"/tmp/".to_owned()+&PACKAGE_NAME.to_owned()+".log");