Skip to content

Commit 0c5bcfb

Browse files
committed
add docs
1 parent cad4bc5 commit 0c5bcfb

File tree

2 files changed

+75
-1
lines changed

2 files changed

+75
-1
lines changed

doc/specs/stdlib_system.md

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -646,6 +646,80 @@ Subroutine
646646

647647
---
648648

649+
## `get_cwd` - Gets the current working directory
650+
651+
### Status
652+
653+
Experimental
654+
655+
### Description
656+
657+
It gets the current working directory associated with the process calling this subroutine.
658+
It is designed to work across multiple platforms. On Windows, paths with both forward `/` and backward `\` slashes are accepted.
659+
660+
### Syntax
661+
662+
`call [[stdlib_system(module):get_cwd(subroutine)]] (cwd, err)`
663+
664+
### Class
665+
666+
Subroutine
667+
668+
### Arguments
669+
670+
`cwd`: Shall be a character string containing the path of the current working directory (cwd). It is an `intent(out)` argument.
671+
672+
`err`: Shall be of type `state_type`, for error handling. It is an `intent(out)` argument.
673+
674+
### Return values
675+
676+
The `err` is set accordingly.
677+
678+
### Example
679+
680+
```fortran
681+
{!example/system/example_cwd.f90!}
682+
```
683+
684+
---
685+
686+
## `set_cwd` - Sets the current working directory
687+
688+
### Status
689+
690+
Experimental
691+
692+
### Description
693+
694+
It sets the current working directory associated with the process calling this subroutine.
695+
It is designed to work across multiple platforms. On Windows, paths with both forward `/` and backward `\` slashes are accepted.
696+
697+
### Syntax
698+
699+
`call [[stdlib_system(module):set_cwd(subroutine)]] (path, err)`
700+
701+
### Class
702+
703+
Subroutine
704+
705+
### Arguments
706+
707+
`path`: Shall be a character string containing the path of the directory. It is an `intent(in)` argument.
708+
709+
`err`: Shall be of type `state_type`, for error handling. It is an `intent(out)` argument.
710+
711+
### Return values
712+
713+
The `err` is set accordingly.
714+
715+
### Example
716+
717+
```fortran
718+
{!example/system/example_cwd.f90!}
719+
```
720+
721+
---
722+
649723
## `null_device` - Return the null device file path
650724

651725
### Status

src/stdlib_system.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ char* stdlib_get_cwd(size_t* len, int* stat){
5858
return NULL;
5959
}
6060

61-
*len = strlen(buffer)
61+
*len = strlen(buffer);
6262
return buffer;
6363
#else
6464
char buffer[PATH_MAX + 1];

0 commit comments

Comments
 (0)