summary history branches tags files
commit:96c24f33d2a617c893fcfb2188ebc1e9f2c1e9a0
author:Trevor Bentley
committer:Trevor Bentley
date:Wed Aug 2 23:42:48 2017 +0200
parents:30de5c7cdb8e7bc82d5556298720dbf108472b7f
Fruitbasket 0.5, handle launching on non-OS-X
diff --git a/Cargo.toml b/Cargo.toml
line changes: +1/-1
index 76efc91..91d8209
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -48,7 +48,7 @@ log4rs = "0.6.3"
 ctrlc = "3.0.1"
 
 [dependencies.fruitbasket]
-version = "0.4"
+version = "0.5"
 features = ["logging"]
 
 [target."cfg(windows)".dependencies]

diff --git a/src/main.rs b/src/main.rs
line changes: +11/-8
index d774cfc..c5fe939
--- a/src/main.rs
+++ b/src/main.rs
@@ -13,6 +13,8 @@ use rubrail::SpacerType;
 use rubrail::SwipeState;
 
 extern crate fruitbasket;
+use fruitbasket::FruitApp;
+use fruitbasket::FruitError;
 
 extern crate ctrlc;
 use std::sync::atomic::{AtomicBool, Ordering};
@@ -826,7 +828,7 @@ fn main() {
         .join("LICENSE");
     let ini = std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR"))
         .join("connectr.ini.in");
-    if let Ok(nsapp) = fruitbasket::Trampoline::new(
+    let nsapp = match fruitbasket::Trampoline::new(
         "Connectr", "connectr", "com.trevorbentley.connectr")
         .icon("connectr.icns")
         .version(env!("CARGO_PKG_VERSION"))
@@ -837,13 +839,14 @@ fn main() {
         .resource(license.to_str().unwrap())
         .resource(ini.to_str().unwrap())
         .build(fruitbasket::InstallDir::Custom("target/".to_string())) {
-            nsapp.set_activation_policy(fruitbasket::ActivationPolicy::Prohibited);
-        }
-    else {
-        error!("Failed to create OS X bundle!");
-        std::process::exit(1);
-    }
-
+            Ok(app) => { app },
+            Err(FruitError::UnsupportedPlatform(_)) => { FruitApp::new() },
+            _ => {
+                error!("Couldn't create Mac app bundle.");
+                std::process::exit(1);
+            },
+        };
+    nsapp.set_activation_policy(fruitbasket::ActivationPolicy::Prohibited);
     info!("Started Connectr");
 
     let running = Arc::new(AtomicBool::new(true));