aboutsummaryrefslogtreecommitdiff
path: root/launcher/src/main.rs
diff options
context:
space:
mode:
authorRaindropsSys <raindrops@equestria.dev>2024-05-10 22:59:19 +0200
committerRaindropsSys <raindrops@equestria.dev>2024-05-10 22:59:19 +0200
commit2a6714bb00afebe50ce92ed726a50e11c0874966 (patch)
treea3ab548c1db093da83d1db4f01c73610c4d85a7f /launcher/src/main.rs
parentd56b6536f95ef928bcb0c690280887d976c60b9b (diff)
downloadatomic-2a6714bb00afebe50ce92ed726a50e11c0874966.tar.gz
atomic-2a6714bb00afebe50ce92ed726a50e11c0874966.tar.bz2
atomic-2a6714bb00afebe50ce92ed726a50e11c0874966.zip
Crappy code fix 14/?
Diffstat (limited to 'launcher/src/main.rs')
-rw-r--r--launcher/src/main.rs19
1 files changed, 14 insertions, 5 deletions
diff --git a/launcher/src/main.rs b/launcher/src/main.rs
index 6fb8bc8..4e61592 100644
--- a/launcher/src/main.rs
+++ b/launcher/src/main.rs
@@ -1,9 +1,8 @@
mod search_path;
-mod constants;
use std::path::PathBuf;
use std::process;
-use launcher::AppData;
+use launcher::{AppData, AppDataError, constants};
fn show_system_info() {
println!(
@@ -70,7 +69,7 @@ fn locate_runtime() -> Option<PathBuf> {
.next()
}
-fn launch_app(runtime_path: Option<PathBuf>, app_data: Option<AppData>) {
+fn launch_app(runtime_path: Option<PathBuf>, app_data: Result<AppData, AppDataError>) {
if let Some(path) = runtime_path {
println!(
"atomic-launcher: Found atomic-runtime at {}",
@@ -80,8 +79,18 @@ fn launch_app(runtime_path: Option<PathBuf>, app_data: Option<AppData>) {
cmd.env("ATOMIC_LAUNCHER_VERSION", constants::VERSION);
println!("atomic-launcher: Executing: {:?}", cmd);
- if let Some(app_data) = app_data {
- cmd.arg(app_data.get_path());
+ match app_data {
+ Ok(app_data) => {
+ cmd.arg(app_data.get_path());
+ }
+ Err(AppDataError::NotFound(app_path_folder, app_path_asar)) => {
+ println!(
+ "atomic-launcher: Warning: Could not find Electron-compatible app.\
+ Looked in {} and {}. The default atomic-runtime application will be opened instead.",
+ app_path_folder.to_str().unwrap(),
+ app_path_asar.to_str().unwrap()
+ );
+ }
}
if let Ok(status) = cmd.status() {