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