|
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
|
@@ -82,6 +82,11 @@ function parse_f_source(f_filename,error) result(f_source)
|
82 | 82 | type(string_t), allocatable :: file_lines(:), file_lines_lower(:)
|
83 | 83 | character(:), allocatable :: temp_string, mod_name, string_parts(:)
|
84 | 84 |
|
| 85 | + if (.not. exists(f_filename)) then |
| 86 | + call file_not_found_error(error, f_filename) |
| 87 | + return |
| 88 | + end if |
| 89 | + |
85 | 90 | f_source%file_name = f_filename
|
86 | 91 |
|
87 | 92 | open(newunit=fh,file=f_filename,status='old')
|
|
0 commit comments