22 use stdlib_ascii, only: reverse
33 use stdlib_strings, only: chomp, find, join
44contains
5- module pure function join2(p1, p2) result(path)
5+ module function join2 (p1 , p2 ) result(path)
66 character (:), allocatable :: path
77 character (* ), intent (in ) :: p1, p2
88
9- path = trim (p1) // pathsep // trim (p2)
9+ path = trim (p1) // path_sep() // trim (p2)
1010 end function join2
1111
12- module pure function joinarr(p) result(path)
12+ module function joinarr (p ) result(path)
1313 character (:), allocatable :: path
1414 character (* ), intent (in ) :: p(:)
1515
16- path = join(p, pathsep )
16+ path = join(p, path_sep() )
1717 end function joinarr
1818
19- module pure function join_op(p1, p2) result(path)
19+ module function join_op (p1 , p2 ) result(path)
2020 character (:), allocatable :: path
2121 character (* ), intent (in ) :: p1, p2
2222
@@ -28,6 +28,8 @@ module subroutine split_path(p, head, tail)
2828 character (:), allocatable , intent (out ) :: head, tail
2929 character (:), allocatable :: temp
3030 integer :: i
31+ character (len= 1 ) :: sep
32+ sep = path_sep()
3133
3234 ! Empty string, return (.,'')
3335 if (trim (p) == ' ' ) then
@@ -37,28 +39,28 @@ module subroutine split_path(p, head, tail)
3739 end if
3840
3941 ! Remove trailing path separators
40- temp = trim (chomp(trim (p), pathsep ))
42+ temp = trim (chomp(trim (p), sep ))
4143
4244 if (temp == ' ' ) then
43- head = pathsep
45+ head = sep
4446 tail = ' '
4547 return
4648 end if
4749
48- i = find(reverse(temp), pathsep )
50+ i = find(reverse(temp), sep )
4951
5052 ! if no `pathsep`, then it probably was a root dir like `C:\`
5153 if (i == 0 ) then
52- head = temp // pathsep
54+ head = temp // sep
5355 tail = ' '
5456 return
5557 end if
5658
5759 head = temp(:len (temp)- i)
5860
5961 ! child of a root directory
60- if (find(head, pathsep ) == 0 ) then
61- head = head // pathsep
62+ if (find(head, sep ) == 0 ) then
63+ head = head // sep
6264 end if
6365
6466 tail = temp(len (temp)- i+2 :)
0 commit comments