# HG changeset patch # User Jiri Vanek # Date 1550506464 -3600 # Node ID 775337c8f04953a044f3988d92de5428e92ad2ca # Parent f3b0e27f23a959492a1a44bb437e959877411380 Fixed bug when Option conained "" insted of being None in case of hardcoded paths. diff -r f3b0e27f23a9 -r 775337c8f049 rust-launcher/src/hardcoded_paths.rs --- a/rust-launcher/src/hardcoded_paths.rs Mon Feb 18 15:37:19 2019 +0100 +++ b/rust-launcher/src/hardcoded_paths.rs Mon Feb 18 17:14:24 2019 +0100 @@ -54,20 +54,35 @@ pub fn get_bootcp() -> &'static str {LAUNCHER_BOOTCLASSPATH.unwrap_or("LAUNCHER_BOOTCLASSPATH-dev-unspecified") } // optional deps -pub fn get_plugin() -> Option<&'static str> { - PLUGIN_JAR -} +pub fn get_plugin() -> Option<&'static str> { sanitize(PLUGIN_JAR) } + +pub fn get_jsobject() -> Option<&'static str> { sanitize(JSOBJECT_JAR) } -pub fn get_jsobject() -> Option<&'static str> { JSOBJECT_JAR } +pub fn get_tagsoup() -> Option<&'static str> { sanitize(TAGSOUP_JAR) } -pub fn get_tagsoup() -> Option<&'static str> { TAGSOUP_JAR } - -pub fn get_rhino() -> Option<&'static str> { RHINO_JAR } +pub fn get_rhino() -> Option<&'static str> { sanitize(RHINO_JAR) } pub fn get_argsfile() -> &'static str { MODULARJDK_ARGS_LOCATION.unwrap_or("MODULARJDK_ARGS_LOCATION-dev-unspecified") } +//unluckily, option_env can go wild and retunr Some("") isntead of None. Fixing here. +fn sanitize(candidate: Option<&'static str>) -> Option<&'static str> { + match candidate { + Some(s) => { + if !String::from(String::from(s).trim()).is_empty() { + return candidate; + } else { + return None; + } + } + _none => { + return None; + } + } + return None; +} + #[derive(PartialEq)] pub enum ItwLibSearch {