-
Notifications
You must be signed in to change notification settings - Fork 193
feat: get_cwd
and set_cwd
#1014
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
I am honestly not sure how I should go about testing these functions independently |
If I uncerstand correctly, it looks like you're already doing that by invoking |
Those are commits from the other branch @sebastian-mutz, the one in this PR: #1014 I don't think I can use |
Suggestions for testing (summarising from the chat with Jose): For testing For testing Alternatively, using |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for this PR @wassup05. Here is a couple of comments:
- the state handler
err
should be optional. So, the internalhandle
ing features returning the state variable if present, or triggering an error stop if not. This will make behavior consistent to everywhere else. - For testing: I think set/get can be tested in the same test program imho. Here is an example:
- get current directory and save it to "pwd" variable -> must be successful
- create a new local temporary directory -> must be successful
set_cwd
to thatget_cwd
should now return the temporary directoryset_cwd
back to "pwd"- check successful
I suggest to merge this PR after directory handling is merged into the library already.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here are a few additional comments. I suggest the err
output variable to be made optional
in all cases, consistent with the library. call err0%handle(err)
already includes the option to halt on error, if err
is not present
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thank you @wassup05. As a follow up, may I suggest that the C->Fortran string conversion routine be put, part of a separate PR, into the stdlib_strings
module into the to_string
interface.
Depends on #1011
get_cwd (cwd, err)
- Gets the current working directory (cwd) of the process.set_cwd (path, err)
- Sets the current working directory (cwd) of the process.getcwd, chdir
on Unix and_getcwd, _chdir
on Windowsstate_type
and both the platform specific error code and the user friendly error message are provided if an error occurs