@@ -93,6 +93,8 @@ module stdlib_system
93
93
public :: split_path
94
94
public :: base_name
95
95
public :: dir_name
96
+ public :: is_abs
97
+ public :: abs_path
96
98
97
99
! ! version: experimental
98
100
! !
@@ -781,6 +783,46 @@ module function dir_name_string(p) result(dir)
781
783
end function dir_name_string
782
784
end interface dir_name
783
785
786
+ interface is_abs
787
+ ! ! version: experimental
788
+ ! !
789
+ ! !### Summary
790
+ ! ! This function checks if the path is absolute.
791
+ ! ! ([Specification](../page/specs/stdlib_system.html#is_abs))
792
+ ! !
793
+ ! !### Description
794
+ ! ! This function checks if the path is absolute (i.e not relative).
795
+ ! ! - On POSIX systems this means the path starts with `/`.
796
+ ! ! - On Windows systems this means the path is either an UNC path (like `\\host\path\share`) or
797
+ ! ! a path starting with a drive letter (like `C:\Users\`)
798
+ module logical function is_abs_char(p)
799
+ character (len=* ), intent (in ) :: p
800
+ end function is_abs_char
801
+
802
+ module logical function is_abs_string(p)
803
+ type (string_type), intent (in ) :: p
804
+ end function is_abs_string
805
+ end interface is_abs
806
+
807
+ interface abs_path
808
+ ! ! version: experimental
809
+ ! !
810
+ ! !### Summary
811
+ ! ! This function returns the absolutized version of the provided path.
812
+ ! ! ([Specification](../page/specs/stdlib_system.html#abs_path))
813
+ ! !
814
+ module function abs_path_char (p , err ) result(abs_p)
815
+ character (len=* ), intent (in ) :: p
816
+ type (state_type), optional , intent (out ) :: err
817
+ character (len= :), allocatable :: abs_p
818
+ end function abs_path_char
819
+
820
+ module function abs_path_string (p , err ) result(abs_p)
821
+ type (string_type), intent (in ) :: p
822
+ type (state_type), optional , intent (out ) :: err
823
+ type (string_type) :: abs_p
824
+ end function abs_path_string
825
+ end interface abs_path
784
826
785
827
contains
786
828
0 commit comments