-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Add a few useful os calls to nimscript #7442
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
Conversation
|
Maybe to rename a functions? For compatibility with stdlib. |
|
@Araq preferred different names which is why I did it this way. |
| ## Moves the dir `from` to `to`. | ||
| log "mvDir: " & `from` & ", " & to: | ||
| moveDir `from`, to | ||
| checkOsError() |
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.
This is unrelated to your PR, but why is this checkOsError needed? Won't movedDir etc. raise OSError?
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.
The exceptions are caught in template cbos() and errorMsg is set there for checkOsError() to check and re-raise it.
It has just occurred to me why perhaps following Rust's convention might have made sense, exclamation mark at the end of every compile-time proc. Of course this would have had to be done before Rust was even a thing :) |
|
|
Sorry this took so long to review. The names are wrong. NimScript names differ from the stdlib names iff they do different things. |
|
I noticed I can change where() and pwd() back to their original names if there's a way to avoid the conflict in the future without requiring any script changes. |
|
Well currently you cannot import os in NimScript and once you can you need to disambiguate via |
|
Sounds fair since there's also fileExists(), paramCount() and other such procs which share names so this isn't anything new. I'll change to getCurrentDir() and findExe() and push. |
|
Added to changelog under "Library additions". |
Added the following procs to nimscript:-
I was going to add some test cases into tests/newconfig/tfoo.nims but realized the
nimsextension is not covered bytestament.