@@ -104,9 +104,12 @@ module stdlib_system
104104! !
105105! !### Description
106106! !
107- ! ! This function checks if a given file system path is a directory. It is cross-platform and utilizes
108- ! ! native system calls. It supports common operating systems such as Linux, macOS,
109- ! ! Windows, and various UNIX-like environments. On unsupported operating systems, the function will return `.false.`.
107+ ! ! This function checks if a given file system path is a directory.
108+ ! ! It follows symbolic links to return the status of the `target`.
109+ ! !
110+ ! ! It is cross-platform and utilizes native system calls.
111+ ! ! It supports common operating systems such as Linux, macOS, Windows, and various UNIX-like environments.
112+ ! ! On unsupported operating systems, the function will return `.false.`.
110113! !
111114public :: is_directory
112115
@@ -237,12 +240,44 @@ module stdlib_system
237240! ! - Directory
238241! ! - Symbolic Link
239242! !
243+ ! ! It does not follow symbolic links.
244+ ! !
240245! ! It returns a constant representing the detected path type, or `type_unknown` if the type cannot be determined.
241246! ! Any encountered errors are handled using `state_type`.
242247! !
243248public :: exists
244249
250+ ! ! version: experimental
251+ ! !
252+ ! ! Tests if a given path is a symbolic link.
253+ ! ! ([Specification](../page/specs/stdlib_system.html#is_directory-test-if-a-path-is-a-directory))
254+ ! !
255+ ! !### Summary
256+ ! ! Function to evaluate whether a specified path corresponds to a symbolic link.
257+ ! !
258+ ! !### Description
259+ ! !
260+ ! ! This function checks if a given file system path is a symbolic link either to a
261+ ! ! file or a directory. It is cross-platform and utilizes native system calls.
262+ ! ! It supports common operating systems such as Linux, macOS, Windows, and various UNIX-like environments.
263+ ! !
245264public :: is_symlink
265+
266+ ! ! version: experimental
267+ ! !
268+ ! ! Tests if a given path is a regular file (Not a symbolic link or directory).
269+ ! ! ([Specification](../page/specs/stdlib_system.html#is_directory-test-if-a-path-is-a-directory))
270+ ! !
271+ ! !### Summary
272+ ! ! Function to evaluate whether a specified path corresponds to a regular file.
273+ ! !
274+ ! !### Description
275+ ! !
276+ ! ! This function checks if a given file system path is a regular file.
277+ ! ! It follows symbolic links to return the status of the `target`.
278+ ! ! It is cross-platform and utilizes native system calls.
279+ ! ! It supports common operating systems such as Linux, macOS, Windows, and various UNIX-like environments.
280+ ! !
246281public :: is_regular_file
247282
248283! CPU clock ticks storage
@@ -1207,23 +1242,26 @@ end function stdlib_exists
12071242 end if
12081243end function exists
12091244
1245+ ! public convenience wrapper to check if path is a symbolic link
12101246logical function is_symlink (path )
12111247 character (len=* ), intent (in ) :: path
12121248
12131249 is_symlink = exists(path) == fs_type_symlink
12141250end function is_symlink
12151251
1252+ ! checks if path is a regular file.
1253+ ! It follows symbolic links and returns the status of the `target`.
12161254logical function is_regular_file (path )
12171255 character (len=* ), intent (in ) :: path
12181256
12191257 interface
12201258 logical (c_bool) function stdlib_is_regular_file(path) bind(C, name= ' stdlib_is_regular_file' )
12211259 import c_char, c_bool
1222- character (kind= c_char) :: path(: )
1260+ character (kind= c_char) :: path(* )
12231261 end function stdlib_is_regular_file
12241262 end interface
12251263
1226- is_regular_file = logical (stdlib_is_regular_file(to_c_char(path)))
1264+ is_regular_file = logical (stdlib_is_regular_file(to_c_char(trim ( path) )))
12271265end function is_regular_file
12281266
12291267character function path_sep ()
0 commit comments