Skip to content

Commit b272c74

Browse files
committed
make err optional
1 parent 2005065 commit b272c74

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

doc/specs/stdlib_system.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -654,7 +654,7 @@ Experimental
654654

655655
### Description
656656

657-
This subroutine retrieves the current working directory, the running process is executing from.
657+
This subroutine retrieves the current working directory the running process is executing from.
658658
It is designed to work across multiple platforms. On Windows, paths with both forward `/` and backward `\` slashes are accepted.
659659

660660
### Syntax

example/system/example_cwd.f90

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
! Illustrate the usage of get_cwd, set_cwd
1+
! Illustrate the usage of `get_cwd`, `set_cwd`
22
program example_cwd
33
use stdlib_system, only: get_cwd, set_cwd
44
use stdlib_error, only: state_type

src/stdlib_system.F90

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -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
!!
170170
public :: 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
!!
183183
public :: set_cwd
184184

@@ -1064,7 +1064,7 @@ end subroutine remove_directory
10641064

10651065
subroutine 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

10931093
subroutine 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
11131113
end subroutine set_cwd

0 commit comments

Comments
 (0)