Skip to content

Commit

Permalink
fixed stupid mistake
Browse files Browse the repository at this point in the history
  • Loading branch information
F0903 committed Dec 3, 2023
1 parent ea15064 commit 592de08
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 8 deletions.
6 changes: 3 additions & 3 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 @@ -2,7 +2,7 @@
members = ["shared", "notification_provider"]

[workspace.package]
version = "2.0.3"
version = "2.0.4"
edition = "2021"
publish = false
repository = "https://github.com/F0903/AutoPower"
Expand Down
3 changes: 3 additions & 0 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ fn copy_powershell_scripts() -> Result<()> {
continue;
}

#[cfg(debug_assertions)]
std::fs::copy(file.path(), format!("./target/debug/{}", file_name_str))?;
#[cfg(not(debug_assertions))]
std::fs::copy(file.path(), format!("./target/release/{}", file_name_str))?;
}
Ok(())
Expand Down
10 changes: 8 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -218,11 +218,14 @@ unsafe extern "system" fn service_main(_arg_num: u32, _args: *mut PWSTR) {

fn service_setup() -> Result<()> {
std::panic::set_hook(Box::new(|info| {
LOGGER.error(info);
LOGGER.error(format!("Fatal panic!\n {}", info));
}));

LOGGER.debug("Starting setup...");
let mut service_name = to_win32_wstr(SERVICE_NAME);
LOGGER.debug(format!("Service name is: {}", unsafe {
service_name.get_const().display()
}));
let service_entry = SERVICE_TABLE_ENTRYW {
lpServiceName: service_name.get_mut(),
lpServiceProc: Some(service_main),
Expand All @@ -244,5 +247,8 @@ fn main() -> Result<()> {
return Ok(());
}

service_setup()
if let Err(e) = service_setup() {
LOGGER.error(format!("Fatal error!\n {}", e))
}
Ok(())
}
1 change: 0 additions & 1 deletion src/notification_provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ impl NotificationProvider {
name: "display".to_owned(),
content: format!("{}\n{}", title, description),
};
let command = bincode::serialize(&command)?;
self.pipe.write_as(&command)?;
Ok(())
}
Expand Down
2 changes: 1 addition & 1 deletion variables.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
$Global:ServiceName = 'AutoPower'
$Global:ServiceName = "AutoPower"
$Global:Dir = "$($PSScriptRoot)\autopower.exe"
$Global:NotifierPath = "$($PSScriptRoot)\autopower_notification_provider.exe"
$Global:NotifierName = "AutoPower Notification Provider"
Expand Down

0 comments on commit 592de08

Please sign in to comment.