Skip to content

Commit d913f93

Browse files
committed
Add docs
1 parent 9da3ea7 commit d913f93

File tree

2 files changed

+149
-7
lines changed

2 files changed

+149
-7
lines changed

doc/specs/stdlib_io.md

Lines changed: 143 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,149 @@ Provides a text file called `filename` that contains the rank-2 `array`.
123123
{!example/io/example_savetxt.f90!}
124124
```
125125

126+
## `is_windows`
127+
128+
### Status
129+
130+
Experimental
131+
132+
### Description
133+
134+
Returns a logical value indicating whether the current operating system is Windows.
135+
136+
### Syntax
137+
138+
`is_windows = ` [[stdlib_io_filesystem(module):is_windows(function)]] `()`
139+
140+
### Return value
141+
142+
A logical value indicating whether the current operating system is Windows.
143+
144+
## `path_separator`
145+
146+
### Status
147+
148+
Experimental
149+
150+
### Description
151+
152+
Returns the path separator for the current operating system.
153+
154+
### Syntax
155+
156+
`separator = ` [[stdlib_io_filesystem(module):path_separator(function)]] `()`
157+
158+
### Return value
159+
160+
A character value containing the path separator for the current operating system.
161+
162+
## `exists`
163+
164+
### Status
165+
166+
Experimental
167+
168+
### Description
169+
170+
Determines if a file or directory exists at the given path by returning a logical value.
171+
172+
### Syntax
173+
174+
`exists = ` [[stdlib_io_filesystem(module):exists(function)]] `(path)`
175+
176+
### Arguments
177+
178+
`path`: Shall be a character expression containing the path to a file or directory to check for existence.
179+
180+
### Return value
181+
182+
A logical value indicating whether a file or directory exists at the given path.
183+
184+
## `list_dir`
185+
186+
### Status
187+
188+
Experimental
189+
190+
### Description
191+
192+
Lists the contents of a directory.
193+
194+
### Syntax
195+
196+
`call ` [[stdlib_io_filesystem(module):list_dir(subroutine)]] `(dir, files[, iostat][, iomsg])`
197+
198+
### Arguments
199+
200+
`dir`: Shall be a character expression containing the path to the directory to list.
201+
202+
`files`: Shall be an allocatable rank-1 array of type `string_type` that will contain the names of the files and directories in the directory.
203+
204+
`iostat`: Shall be a scalar of type `integer` that receives the error status of `list_dir`. Optional argument.
205+
206+
`iomsg`: Shall be a deferred length character variable that receives the error message of `list_dir`. Optional argument.
207+
208+
## `mkdir`
209+
210+
### Status
211+
212+
Experimental
213+
214+
### Description
215+
216+
Creates a new directory.
217+
218+
### Syntax
219+
220+
`call ` [[stdlib_io_filesystem(module):mkdir(subroutine)]] `(dir[, iostat][, iomsg])`
221+
222+
### Arguments
223+
224+
`dir`: Shall be a character expression containing the path to the directory to create.
225+
226+
`iostat`: Shall be a scalar of type `integer` that receives the error status of `mkdir`. Optional argument.
227+
228+
`iomsg`: Shall be a deferred length character variable that receives the error message of `mkdir`. Optional argument.
229+
230+
## `rmdir`
231+
232+
### Status
233+
234+
Experimental
235+
236+
### Description
237+
238+
Removes a directory.
239+
240+
### Syntax
241+
242+
`call ` [[stdlib_io_filesystem(module):rmdir(subroutine)]] `(dir)`
243+
244+
### Arguments
245+
246+
`dir`: Shall be a character expression containing the path to the directory to remove.
247+
248+
## `run`
249+
250+
### Status
251+
252+
Experimental
253+
254+
### Description
255+
256+
Runs a command in the shell.
257+
258+
### Syntax
259+
260+
`call ` [[stdlib_io_filesystem(module):run(subroutine)]] `(command[, iostat][, iomsg])`
261+
262+
### Arguments
263+
264+
`command`: Shall be a character expression containing the command to run in the shell.
265+
266+
`iostat`: Shall be a scalar of type `integer` that receives the error status of `run`. Optional argument.
267+
268+
`iomsg`: Shall be a deferred length character variable that receives the error message of `run`. Optional argument.
126269

127270
## `load_npy`
128271

@@ -164,7 +307,6 @@ Returns an allocated `array` with the content of `filename` in case of success.
164307
{!example/io/example_loadnpy.f90!}
165308
```
166309

167-
168310
## `save_npy`
169311

170312
### Status

src/stdlib_io_filesystem.F90

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ logical function is_windows()
3535

3636
!> Version: experimental
3737
!>
38-
!> Separator for paths.
38+
!> Returns the path separator for the current operating system.
3939
!> [Specification](../page/specs/stdlib_io.html#path_separator)
4040
character function path_separator()
4141
if (is_windows()) then
@@ -49,14 +49,14 @@ character function path_separator()
4949
!>
5050
!> Whether a file or directory exists at the given path.
5151
!> [Specification](../page/specs/stdlib_io.html#exists)
52-
logical function exists(filename)
53-
!> Name of the file or directory.
54-
character(len=*), intent(in) :: filename
52+
logical function exists(path)
53+
!> Path to a file or directory.
54+
character(len=*), intent(in) :: path
5555

56-
inquire(file=filename, exist=exists)
56+
inquire(file=path, exist=exists)
5757

5858
#if defined(__INTEL_COMPILER)
59-
if (.not. exists) inquire(directory=filename, exist=exists)
59+
if (.not. exists) inquire(directory=path, exist=exists)
6060
#endif
6161
end
6262

0 commit comments

Comments
 (0)