path_util Module

Policy (see doc/superpowers/specs/2026-07-04-case-paths-inline-config-mp-gather): every file the namelist references (grid, and later restart/data/output) is resolved against the case directory — by default the directory of the namelist itself — with ABSOLUTE paths honored as-is. This is the OpenFOAM -case / #include-relative model: a case is a movable folder, resolvable regardless of the process working directory.


Functions

public pure function is_absolute_path(path) result(is_abs)

True if path is absolute: POSIX "/…", a Windows drive "X:\…"/"X:/…", or a UNC "\…" path. Used so a user-supplied absolute grid path is left untouched while relative paths are anchored to the case directory.

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: path

Return Value logical

public pure function case_base_dir(nml_path, override) result(dir)

The case directory used to anchor a namelist's relative file paths: the explicit override when supplied and non-empty (the OpenFOAM -case / GUI-supplied case dir), otherwise the namelist file's own directory. This is the single place the "override-or-namelist-dir" rule lives.

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: nml_path
character(len=*), intent(in), optional :: override

Return Value character(len=:), allocatable

public pure function path_dirname(path) result(dir)

Directory part of path (everything up to the last '/' or '\'); '.' when path has no directory component. The trailing separator is dropped.

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: path

Return Value character(len=len)

public pure function resolve_case_path(base_dir, value) result(path)

Resolve a namelist file-valued parameter against a case directory. Absolute or empty value is returned unchanged; a relative value is joined onto base_dir with a '/' (accepted by the runtime on both POSIX and Windows). A '.' or empty base_dir leaves value unchanged.

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: base_dir
character(len=*), intent(in) :: value

Return Value character(len=len_trim)