summary history branches tags files
commit:6626938489cb99c9c2bce397f97c0a411c69c36d
author:Trevor Bentley
committer:GitHub
date:Wed Aug 26 17:31:17 2020 +0200
parents:0468eac696677c9a9bd142ebd3a080adde76b20a, 973bb4b674c12a5a619ff77fe3c3651165a69444
Merge pull request #22 from LoganDark/self_bundle

Make self_bundle public
diff --git a/src/lib.rs b/src/lib.rs
line changes: +6/-1
index cfc71f6..60ccd68
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -227,7 +227,12 @@ impl Trampoline {
     /// Docs in OS X build.
     pub fn resources(&mut self, _files: &Vec<&str>) -> &mut Self{ self }
     /// Docs in OS X build.
-    pub fn build(&mut self, _dir: InstallDir) -> Result<FruitApp, FruitError> {
+    pub fn build(&mut self, dir: InstallDir) -> Result<FruitApp, FruitError> {
+        self.self_bundle(dir)?;
+        unreachable!()
+    }
+    /// Docs in OS X build.
+    pub fn self_bundle(&mut self, _dir: InstallDir) -> Result<(), FruitError> {
         Err(FruitError::UnsupportedPlatform("fruitbasket disabled or not supported on this platform.".to_string()))
     }
     /// Docs in OS X build.

diff --git a/src/osx.rs b/src/osx.rs
line changes: +5/-1
index dc4518c..cf77594
--- a/src/osx.rs
+++ b/src/osx.rs
@@ -421,7 +421,11 @@ impl Trampoline {
             ident != nil
         }
     }
-    fn self_bundle(&self, dir: InstallDir) -> Result<(), FruitError> {
+    /// Same as `build`, but does not construct a FruitApp if successful.
+    ///
+    /// Useful if you'd like to use a GUI library, such as libui, and don't
+    /// want fruitbasket to try to initialize anything for you. Bundling only.
+    pub fn self_bundle(&self, dir: InstallDir) -> Result<(), FruitError> {
         unsafe {
             if Self::is_bundled() {
                 return Ok(());