We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 713ed1c commit 39ab1b7Copy full SHA for 39ab1b7
doc/specs/stdlib_system.md
@@ -583,7 +583,7 @@ Experimental
583
584
### Description
585
586
-This function checks if a specified file system path is a symbolic link to either a file or a directory.
+This function checks if a specified file system path is a symbolic link to either a file or a directory.
587
Use [[stdlib_system(module):is_regular_file(function)]] and [[stdlib_system(module):is_directory(function)]] functions
588
to check further if the link is to a file or a directory respectively.
589
It is designed to work across multiple platforms. On Windows, paths with both forward `/` and backward `\` slashes are accepted.
example/system/CMakeLists.txt
@@ -1,6 +1,5 @@
1
ADD_EXAMPLE(get_runtime_os)
2
ADD_EXAMPLE(delete_file)
3
-ADD_EXAMPLE(is_directory)
4
ADD_EXAMPLE(null_device)
5
ADD_EXAMPLE(os_type)
6
ADD_EXAMPLE(process_1)
@@ -19,3 +18,6 @@ ADD_EXAMPLE(path_dir_name)
19
18
ADD_EXAMPLE(make_directory)
20
ADD_EXAMPLE(remove_directory)
21
ADD_EXAMPLE(exists)
+ADD_EXAMPLE(is_regular_file)
22
+ADD_EXAMPLE(is_directory)
23
+ADD_EXAMPLE(is_symlink)
example/system/example_is_regular_file.f90
@@ -1,14 +1,14 @@
! Demonstrate usage of `is_regular_file`
-program example_is_directory
+program example_is_regular_file
use stdlib_system, only: is_regular_file
implicit none
character(*), parameter :: path = "path/to/check"
7
8
! Test if path is a regular file
9
- if (is_regular_file(path)) then
+ if (is_regular_file(path)) then
10
print *, "The specified path is a regular file."
11
else
12
print *, "The specified path is not a regular file."
13
end if
14
-end program example_is_directory
+end program example_is_regular_file
example/system/example_is_symlink.f90
@@ -1,12 +1,12 @@
! Demonstrate usage of `is_symlink`
+program example_is_symlink
use stdlib_system, only: is_symlink, is_directory
! Test if path is a symbolic link
- if (is_symlink(path)) then
+ if (is_symlink(path)) then
print *, "The specified path is a symlink."
! Further check if it is linked to a file or a directory
if (is_directory(path)) then
@@ -17,4 +17,4 @@ program example_is_directory
17
print *, "The specified path is not a symlink."
+end program example_is_symlink
src/stdlib_system.F90
@@ -1245,8 +1245,9 @@ end function exists
1245
! public convenience wrapper to check if path is a symbolic link
1246
logical function is_symlink(path)
1247
character(len=*), intent(in) :: path
1248
+ type(state_type) :: err
1249
- is_symlink = exists(path) == fs_type_symlink
1250
+ is_symlink = exists(path, err) == fs_type_symlink
1251
end function is_symlink
1252
1253
! checks if path is a regular file.
AltStyle によって変換されたページ (->オリジナル) / アドレス: モード: デフォルト 音声ブラウザ ルビ付き 配色反転 文字拡大 モバイル
0 commit comments