@@ -104,9 +104,12 @@ module stdlib_system
104
104
! !
105
105
! !### Description
106
106
! !
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.`.
110
113
! !
111
114
public :: is_directory
112
115
@@ -237,12 +240,44 @@ module stdlib_system
237
240
! ! - Directory
238
241
! ! - Symbolic Link
239
242
! !
243
+ ! ! It does not follow symbolic links.
244
+ ! !
240
245
! ! It returns a constant representing the detected path type, or `type_unknown` if the type cannot be determined.
241
246
! ! Any encountered errors are handled using `state_type`.
242
247
! !
243
248
public :: exists
244
249
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
+ ! !
245
264
public :: 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
+ ! !
246
281
public :: is_regular_file
247
282
248
283
! CPU clock ticks storage
@@ -1207,23 +1242,26 @@ end function stdlib_exists
1207
1242
end if
1208
1243
end function exists
1209
1244
1245
+ ! public convenience wrapper to check if path is a symbolic link
1210
1246
logical function is_symlink (path )
1211
1247
character (len=* ), intent (in ) :: path
1212
1248
1213
1249
is_symlink = exists(path) == fs_type_symlink
1214
1250
end function is_symlink
1215
1251
1252
+ ! checks if path is a regular file.
1253
+ ! It follows symbolic links and returns the status of the `target`.
1216
1254
logical function is_regular_file (path )
1217
1255
character (len=* ), intent (in ) :: path
1218
1256
1219
1257
interface
1220
1258
logical (c_bool) function stdlib_is_regular_file(path) bind(C, name= ' stdlib_is_regular_file' )
1221
1259
import c_char, c_bool
1222
- character (kind= c_char) :: path(: )
1260
+ character (kind= c_char) :: path(* )
1223
1261
end function stdlib_is_regular_file
1224
1262
end interface
1225
1263
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) )))
1227
1265
end function is_regular_file
1228
1266
1229
1267
character function path_sep ()
0 commit comments