is_path_relative Function

public function is_path_relative(fname) result(res)

Determines if a path is relative or not. Returns True if path is relative and False if path is absolute.

Syntax

 l = is_path_relative(fname)

Where:

  • fname: Name of the path to be checked.

It returns True if fname is a relative path and false otherwise.

Example

The following program checks the if some paths are relative or not:

 PROGRAM is_path_relativeExample
    USE FU_Files, ONLY: is_path_relative
    IMPLICIT NONE
    CHARACTER(LEN=:), ALLOCATABLE :: path
    path='file1'
    WRITE(*,*) path, is_path_relative(path)
    path='./file1'
    WRITE(*,*) path, is_path_relative(path)
    path='/tmp/file1'
    WRITE(*,*) path, is_path_relative(path)
 END PROGRAM is_path_relativeExample

Arguments

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

Path to a file.

Return Value logical

True if the path is relative and false if the path is absolute.


Contents