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
583
583
584
584
### Description
585
585
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.
587
587
Use [[ stdlib_system(module): is_regular_file (function)]] and [[ stdlib_system(module): is_directory (function)]] functions
588
588
to check further if the link is to a file or a directory respectively.
589
589
It 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 1
1
ADD_EXAMPLE (get_runtime_os )
2
2
ADD_EXAMPLE (delete_file )
3
- ADD_EXAMPLE (is_directory )
4
3
ADD_EXAMPLE (null_device )
5
4
ADD_EXAMPLE (os_type )
6
5
ADD_EXAMPLE (process_1 )
@@ -19,3 +18,6 @@ ADD_EXAMPLE(path_dir_name)
19
18
ADD_EXAMPLE (make_directory )
20
19
ADD_EXAMPLE (remove_directory )
21
20
ADD_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 1
1
! Demonstrate usage of `is_regular_file`
2
- program example_is_directory
2
+ program example_is_regular_file
3
3
use stdlib_system, only: is_regular_file
4
4
implicit none
5
5
6
6
character (* ), parameter :: path = " path/to/check"
7
7
8
8
! Test if path is a regular file
9
- if (is_regular_file(path)) then
9
+ if (is_regular_file(path)) then
10
10
print * , " The specified path is a regular file."
11
11
else
12
12
print * , " The specified path is not a regular file."
13
13
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 1
1
! Demonstrate usage of `is_symlink`
2
- program example_is_directory
2
+ program example_is_symlink
3
3
use stdlib_system, only: is_symlink, is_directory
4
4
implicit none
5
5
6
6
character (* ), parameter :: path = " path/to/check"
7
7
8
8
! Test if path is a symbolic link
9
- if (is_symlink(path)) then
9
+ if (is_symlink(path)) then
10
10
print * , " The specified path is a symlink."
11
11
! Further check if it is linked to a file or a directory
12
12
if (is_directory(path)) then
@@ -17,4 +17,4 @@ program example_is_directory
17
17
else
18
18
print * , " The specified path is not a symlink."
19
19
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
1245
1245
! public convenience wrapper to check if path is a symbolic link
1246
1246
logical function is_symlink (path )
1247
1247
character (len=* ), intent (in ) :: path
1248
+ type (state_type) :: err
1248
1249
1249
- is_symlink = exists(path) == fs_type_symlink
1250
+ is_symlink = exists(path, err ) == fs_type_symlink
1250
1251
end function is_symlink
1251
1252
1252
1253
! checks if path is a regular file.
You can’t perform that action at this time.
0 commit comments