resolve_surface_current_model_path Subroutine

public subroutine resolve_surface_current_model_path(config_path, cfg)

response table の相対パスを設定ファイルの配置ディレクトリ基準へ解決する。

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: config_path
type(app_config), intent(inout) :: cfg

Called by

proc~~resolve_surface_current_model_path~~CalledByGraph proc~resolve_surface_current_model_path resolve_surface_current_model_path proc~load_toml_config load_toml_config proc~load_toml_config->proc~resolve_surface_current_model_path proc~load_app_config load_app_config proc~load_app_config->proc~load_toml_config proc~handle_early_cli handle_early_cli proc~handle_early_cli->proc~load_app_config proc~load_or_init_run_state load_or_init_run_state proc~load_or_init_run_state->proc~load_app_config program~zhao_atlas_main zhao_atlas_main program~zhao_atlas_main->proc~load_app_config program~zhao_response_main zhao_response_main program~zhao_response_main->proc~load_app_config program~main main program~main->proc~handle_early_cli program~main->proc~load_or_init_run_state

Source Code

  subroutine resolve_surface_current_model_path(config_path, cfg)
    character(len=*), intent(in) :: config_path
    type(app_config), intent(inout) :: cfg
    character(len=:), allocatable :: resolved_path
    integer :: directory_end

    if (.not. cfg%surface_current%has_response_table_path) return
    if (len_trim(cfg%surface_current%response_table_path) == 0) return
    if (cfg%surface_current%response_table_path(1:1) == '/') return

    directory_end = scan(trim(config_path), '/', back=.true.)
    if (directory_end == 0) return
    resolved_path = config_path(:directory_end)//trim(cfg%surface_current%response_table_path)
    if (len(resolved_path) > len(cfg%surface_current%response_table_path)) then
      error stop 'Resolved surface_current_model.response_table_path is too long.'
    end if
    cfg%surface_current%response_table_path = resolved_path
  end subroutine resolve_surface_current_model_path