ignore the absence of a Pkg-Config file

This commit is contained in:
Folkert 2020-11-08 00:12:15 +01:00
parent 2abdbaae7d
commit e516a0aebb

View file

@ -43,6 +43,9 @@ use std::time::{Duration, SystemTime};
/// Filename extension for normal Roc modules
const ROC_FILE_EXTENSION: &str = "roc";
/// Roc-Config file name
const ROC_CONFIG_FILE_NAME: &str = "Pkg-Config";
/// The . in between module names like Foo.Bar.Baz
const MODULE_SEPARATOR: char = '.';
@ -1736,7 +1739,7 @@ fn load_pkg_config<'a>(
let mut filename = PathBuf::from(src_dir);
filename.push("platform");
filename.push("Pkg-Config");
filename.push(ROC_CONFIG_FILE_NAME);
// End with .roc
filename.set_extension(ROC_FILE_EXTENSION);
@ -1897,6 +1900,12 @@ fn parse_header<'a>(
module_timing,
);
let mut pkg_config_roc = pkg_config_dir.clone();
pkg_config_roc.push("platform");
pkg_config_roc.push(ROC_CONFIG_FILE_NAME);
pkg_config_roc.set_extension(ROC_FILE_EXTENSION);
if pkg_config_roc.as_path().exists() {
let load_pkg_config_msg = load_pkg_config(
arena,
&pkg_config_dir,
@ -1909,6 +1918,9 @@ fn parse_header<'a>(
module_id,
Msg::Many(vec![app_module_header_msg, load_pkg_config_msg]),
))
} else {
Ok((module_id, app_module_header_msg))
}
}
Ok((ast::Module::Platform { header }, _parse_state)) => fabricate_effects_module(
arena,