Skip to content

Commit 39ab1b7

Browse files
committed
misc changes
1 parent 713ed1c commit 39ab1b7

File tree

5 files changed

+12
-9
lines changed

5 files changed

+12
-9
lines changed

doc/specs/stdlib_system.md

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

584584
### Description
585585

586-
This function checks if a specified file system path is a symbolic link to either a file or a directory.
586+
This function checks if a specified file system path is a symbolic link to either a file or a directory.
587587
Use [[stdlib_system(module):is_regular_file(function)]] and [[stdlib_system(module):is_directory(function)]] functions
588588
to check further if the link is to a file or a directory respectively.
589589
It is designed to work across multiple platforms. On Windows, paths with both forward `/` and backward `\` slashes are accepted.

example/system/CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
ADD_EXAMPLE(get_runtime_os)
22
ADD_EXAMPLE(delete_file)
3-
ADD_EXAMPLE(is_directory)
43
ADD_EXAMPLE(null_device)
54
ADD_EXAMPLE(os_type)
65
ADD_EXAMPLE(process_1)
@@ -19,3 +18,6 @@ ADD_EXAMPLE(path_dir_name)
1918
ADD_EXAMPLE(make_directory)
2019
ADD_EXAMPLE(remove_directory)
2120
ADD_EXAMPLE(exists)
21+
ADD_EXAMPLE(is_regular_file)
22+
ADD_EXAMPLE(is_directory)
23+
ADD_EXAMPLE(is_symlink)
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
! Demonstrate usage of `is_regular_file`
2-
program example_is_directory
2+
program example_is_regular_file
33
use stdlib_system, only: is_regular_file
44
implicit none
55

66
character(*), parameter :: path = "path/to/check"
77

88
! Test if path is a regular file
9-
if (is_regular_file(path)) then
9+
if (is_regular_file(path)) then
1010
print *, "The specified path is a regular file."
1111
else
1212
print *, "The specified path is not a regular file."
1313
end if
14-
end program example_is_directory
14+
end program example_is_regular_file

example/system/example_is_symlink.f90

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
! Demonstrate usage of `is_symlink`
2-
program example_is_directory
2+
program example_is_symlink
33
use stdlib_system, only: is_symlink, is_directory
44
implicit none
55

66
character(*), parameter :: path = "path/to/check"
77

88
! Test if path is a symbolic link
9-
if (is_symlink(path)) then
9+
if (is_symlink(path)) then
1010
print *, "The specified path is a symlink."
1111
! Further check if it is linked to a file or a directory
1212
if (is_directory(path)) then
@@ -17,4 +17,4 @@ program example_is_directory
1717
else
1818
print *, "The specified path is not a symlink."
1919
end if
20-
end program example_is_directory
20+
end program example_is_symlink

src/stdlib_system.F90

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1245,8 +1245,9 @@ end function exists
12451245
! public convenience wrapper to check if path is a symbolic link
12461246
logical function is_symlink(path)
12471247
character(len=*), intent(in) :: path
1248+
type(state_type) :: err
12481249

1249-
is_symlink = exists(path) == fs_type_symlink
1250+
is_symlink = exists(path, err) == fs_type_symlink
12501251
end function is_symlink
12511252

12521253
! checks if path is a regular file.

0 commit comments

Comments
 (0)