@@ -165,7 +165,7 @@ module stdlib_system
165165! ! Gets the current working directory.
166166! !
167167! ! ### Description
168- ! ! This subroutine gets the current working directory of the process calling this function .
168+ ! ! This subroutine gets the current working directory the process is executing from .
169169! !
170170public :: get_cwd
171171
@@ -178,7 +178,7 @@ module stdlib_system
178178! ! Changes the current working directory to the one specified.
179179! !
180180! ! ### Description
181- ! ! This subroutine sets the current working directory of the process calling this function to the one specified .
181+ ! ! This subroutine sets the current working directory the process is executing from .
182182! !
183183public :: set_cwd
184184
@@ -1064,7 +1064,7 @@ end subroutine remove_directory
10641064
10651065subroutine get_cwd (cwd , err )
10661066 character (:), allocatable , intent (out ) :: cwd
1067- type (state_type), intent (out ) :: err
1067+ type (state_type), optional , intent (out ) :: err
10681068 type (state_type) :: err0
10691069
10701070 interface
@@ -1082,7 +1082,7 @@ end function stdlib_get_cwd
10821082 c_str_ptr = stdlib_get_cwd(len, stat)
10831083
10841084 if (stat /= 0 ) then
1085- err0 = state_type(STDLIB_FS_ERROR, " code: " , to_string( stat) // " , " , c_get_strerror())
1085+ err0 = FS_ERROR_CODE( stat, c_get_strerror())
10861086 call err0% handle(err)
10871087 end if
10881088
@@ -1092,7 +1092,7 @@ end subroutine get_cwd
10921092
10931093subroutine set_cwd (path , err )
10941094 character (len=* ), intent (in ) :: path
1095- type (state_type), intent (out ) :: err
1095+ type (state_type), optional , intent (out ) :: err
10961096 type (state_type) :: err0
10971097
10981098 interface
@@ -1107,7 +1107,7 @@ end function stdlib_set_cwd
11071107 code = stdlib_set_cwd(to_c_char(trim (path)))
11081108
11091109 if (code /= 0 ) then
1110- err0 = state_type(STDLIB_FS_ERROR, " code: " , to_string(code) // " , " , c_get_strerror())
1110+ err0 = FS_ERROR_CODE( code, c_get_strerror())
11111111 call err0% handle(err)
11121112 end if
11131113end subroutine set_cwd
0 commit comments