|
15 | 15 | !> - `[[parse_c_source]]` |
16 | 16 | !> |
17 | 17 | module fpm_source_parsing |
18 | | -use fpm_error, only: error_t, file_parse_error, fatal_error |
| 18 | +use fpm_error, only: error_t, file_parse_error, fatal_error, file_not_found_error |
19 | 19 | use fpm_strings, only: string_t, string_cat, len_trim, split, lower, str_ends_with, fnv_1a, is_fortran_name |
20 | 20 | use fpm_model, only: srcfile_t, & |
21 | 21 | FPM_UNIT_UNKNOWN, FPM_UNIT_PROGRAM, FPM_UNIT_MODULE, & |
22 | 22 | FPM_UNIT_SUBMODULE, FPM_UNIT_SUBPROGRAM, & |
23 | 23 | FPM_UNIT_CSOURCE, FPM_UNIT_CHEADER, FPM_SCOPE_UNKNOWN, & |
24 | 24 | FPM_SCOPE_LIB, FPM_SCOPE_DEP, FPM_SCOPE_APP, FPM_SCOPE_TEST |
25 | | -use fpm_filesystem, only: read_lines, read_lines_expanded |
| 25 | +use fpm_filesystem, only: read_lines, read_lines_expanded, exists |
26 | 26 | implicit none |
27 | 27 |
|
28 | 28 | private |
@@ -81,6 +81,11 @@ function parse_f_source(f_filename,error) result(f_source) |
81 | 81 | type(string_t), allocatable :: file_lines(:), file_lines_lower(:) |
82 | 82 | character(:), allocatable :: temp_string, mod_name, string_parts(:) |
83 | 83 |
|
| 84 | + if (.not. exists(f_filename)) then |
| 85 | + call file_not_found_error(error, f_filename) |
| 86 | + return |
| 87 | + end if |
| 88 | + |
84 | 89 | f_source%file_name = f_filename |
85 | 90 |
|
86 | 91 | open(newunit=fh,file=f_filename,status='old') |
|
0 commit comments