File tree Expand file tree Collapse file tree 5 files changed +12
-9
lines changed Expand file tree Collapse file tree 5 files changed +12
-9
lines changed Original file line number Diff line number Diff 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.
587587Use [[ stdlib_system(module): is_regular_file (function)]] and [[ stdlib_system(module): is_directory (function)]] functions
588588to check further if the link is to a file or a directory respectively.
589589It is designed to work across multiple platforms. On Windows, paths with both forward ` / ` and backward ` \ ` slashes are accepted.
Original file line number Diff line number Diff line change 11ADD_EXAMPLE(get_runtime_os)
22ADD_EXAMPLE(delete_file)
3- ADD_EXAMPLE(is_directory )
43ADD_EXAMPLE(null_device)
54ADD_EXAMPLE(os_type)
65ADD_EXAMPLE(process_1)
@@ -19,3 +18,6 @@ ADD_EXAMPLE(path_dir_name)
1918ADD_EXAMPLE(make_directory)
2019ADD_EXAMPLE(remove_directory)
2120ADD_EXAMPLE(exists )
21+ ADD_EXAMPLE(is_regular_file)
22+ ADD_EXAMPLE(is_directory )
23+ ADD_EXAMPLE(is_symlink )
Original file line number Diff line number Diff line change 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
Original file line number Diff line number Diff line change 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
Original file line number Diff line number Diff line change @@ -1245,8 +1245,9 @@ end function exists
12451245! public convenience wrapper to check if path is a symbolic link
12461246logical 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
12501251end function is_symlink
12511252
12521253! checks if path is a regular file.
You can’t perform that action at this time.
0 commit comments