mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-26 13:29:12 +00:00
caught incorrect file ext
This commit is contained in:
parent
09d7157216
commit
579522a602
1 changed files with 20 additions and 0 deletions
|
@ -714,6 +714,24 @@ pub fn standard_load_config(
|
|||
}
|
||||
}
|
||||
|
||||
pub fn is_valied_roc_file<'a>(path: PathBuf) -> Result<(), BuildFileError<'a>> {
|
||||
let roc_ext = OsStr::new("roc");
|
||||
match path.extension() {
|
||||
Some(ext) => {
|
||||
if roc_ext != ext {
|
||||
Err(BuildFileError::LoadingProblem(
|
||||
LoadingProblem::FormattedReport("It failed, wrong file ext".to_string()),
|
||||
))
|
||||
} else {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
None => Err(BuildFileError::LoadingProblem(
|
||||
LoadingProblem::FormattedReport("It failed, no file ext".to_string()),
|
||||
)),
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
pub fn build_file<'a>(
|
||||
arena: &'a Bump,
|
||||
|
@ -731,6 +749,8 @@ pub fn build_file<'a>(
|
|||
) -> Result<BuiltFile<'a>, BuildFileError<'a>> {
|
||||
let compilation_start = Instant::now();
|
||||
|
||||
is_valied_roc_file(app_module_path)?;
|
||||
|
||||
// Step 1: compile the app and generate the .o file
|
||||
let loaded =
|
||||
roc_load::load_and_monomorphize(arena, app_module_path.clone(), roc_cache_dir, load_config)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue