absolute_path Function

public function absolute_path(path) result(abs)

path made absolute by prefixing the current directory, unless it already is (starts with / or \, or a drive letter such as C:).

Arguments

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

a relative or absolute path

Return Value character(len=:), allocatable


Calls

proc~~absolute_path~~CallsGraph proc~absolute_path absolute_path proc~current_directory current_directory proc~absolute_path->proc~current_directory proc~is_absolute is_absolute proc~absolute_path->proc~is_absolute proc~join_path join_path proc~absolute_path->proc~join_path interface~c_getcwd c_getcwd proc~current_directory->interface~c_getcwd

Called by

proc~~absolute_path~~CalledByGraph proc~absolute_path absolute_path proc~directory_files directory_files proc~directory_files->proc~absolute_path proc~options_for options_for proc~options_for->proc~absolute_path proc~process_file process_file proc~process_file->proc~absolute_path proc~process_text process_text proc~process_file->proc~process_text proc~process_text->proc~options_for proc~run run proc~run->proc~directory_files proc~run->proc~process_file proc~process_stdin process_stdin proc~run->proc~process_stdin proc~process_stdin->proc~process_text

Source Code

function absolute_path(path) result(abs)
    !! `path` made absolute by prefixing the current directory, unless it already is
    !! (starts with `/` or `\`, or a drive letter such as `C:`).
    character(len=*), intent(in) :: path   !! a relative or absolute path
    character(len=:), allocatable :: abs
    if (is_absolute(path)) then
        abs = path
    else if (path == '.') then
        abs = current_directory()
    else
        abs = join_path(current_directory(), path)
    end if
end function absolute_path