Obtain package meta data from a configuation file
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(package_config_t), | intent(out) | :: | package |
Parsed package meta data |
||
character(len=*), | intent(in) | :: | file |
Name of the package configuration file |
||
type(error_t), | intent(out), | allocatable | :: | error |
Error status of the operation |
|
logical, | intent(in), | optional | :: | apply_defaults |
Apply package defaults (uses file system operations) |
subroutine get_package_data(package, file, error, apply_defaults) !> Parsed package meta data type(package_config_t), intent(out) :: package !> Name of the package configuration file character(len=*), intent(in) :: file !> Error status of the operation type(error_t), allocatable, intent(out) :: error !> Apply package defaults (uses file system operations) logical, intent(in), optional :: apply_defaults type(toml_table), allocatable :: table character(len=:), allocatable :: root call read_package_file(table, file, error) if (allocated(error)) return if (.not. allocated(table)) then call fatal_error(error, "Unclassified error while reading: '"//file//"'") return end if call new_package(package, table, dirname(file), error) if (allocated(error)) return if (present(apply_defaults)) then if (apply_defaults) then root = dirname(file) if (len_trim(root) == 0) root = "." call package_defaults(package, root, error) if (allocated(error)) return end if end if end subroutine get_package_data