Mercurial > hg > release > icedtea-web-1.8
changeset 1560:775337c8f049
Fixed bug when Option conained "" insted of being None in case of hardcoded paths.
author | Jiri Vanek <jvanek@redhat.com> |
---|---|
date | Mon, 18 Feb 2019 17:14:24 +0100 |
parents | f3b0e27f23a9 |
children | 1447647acb3a |
files | rust-launcher/src/hardcoded_paths.rs |
diffstat | 1 files changed, 22 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- 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 {