check for app elevation in Default of Flags
This commit is contained in:
+11
-1
@@ -17,13 +17,23 @@ enum Stage {
|
||||
About,
|
||||
}
|
||||
|
||||
#[derive(Debug, Default)]
|
||||
#[derive(Debug)]
|
||||
pub struct Flags {
|
||||
pub elevated: bool,
|
||||
pub debug: bool,
|
||||
closing: bool,
|
||||
}
|
||||
|
||||
impl Default for Flags {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
elevated: win::is_elevated(),
|
||||
debug: false,
|
||||
closing: false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Default)]
|
||||
pub struct App {
|
||||
pub meta: Meta,
|
||||
|
||||
+1
-3
@@ -34,11 +34,9 @@ fn app_creator(
|
||||
app.settings = persistent_state.settings;
|
||||
}
|
||||
// check if we're elevated. if not, and the user wants an elevated launch - relaunch elevated
|
||||
let elevated = util::win::is_elevated();
|
||||
if app.settings.start_elevated && !elevated {
|
||||
if !app.flags.elevated && app.settings.start_elevated {
|
||||
util::win::elevate(util::win::ElevationExitMethod::Forced);
|
||||
}
|
||||
app.flags.elevated = elevated;
|
||||
// refresh sysinfo because it initializes with nothing
|
||||
app.sysinfo.refresh_all();
|
||||
// enable image loading support in egui
|
||||
|
||||
Reference in New Issue
Block a user