-
Notifications
You must be signed in to change notification settings - Fork 434
Implement remove, remove_all and mkdir #426
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
Draft
imaqtkatt
wants to merge
10
commits into
main
Choose a base branch
from
implement-delete-file-and-directory
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 8 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
1a31be6
wip implement delete functions
imaqtkatt 49c9662
#420 add function to create directories
imaqtkatt 6a6391a
update test snapshots
imaqtkatt 7387ec3
add comment to io_mkdir and remove added tests
imaqtkatt 7dab28a
WIP add functions to cuda
imaqtkatt c3cf50f
fix void cast
imaqtkatt 8ddc3aa
add flags to build.rs
imaqtkatt 38408af
refactor rename and use nftw function
imaqtkatt e303e04
remove unused header file and remove suppress flags
imaqtkatt 4a41670
conditionally define _XOPEN_SOURCE
imaqtkatt File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| #{ | ||
| Creates the batata directory and then removes it. | ||
| #} | ||
|
|
||
| test-io = 1 | ||
|
|
||
| mkdir path = | ||
| (call "MKDIR" path) | ||
|
|
||
| rm_all path = | ||
| (call "RM_ALL" path) | ||
|
|
||
| main = | ||
| let path = "./batata" | ||
| with IO { | ||
| ask * = (mkdir path) | ||
| ask s = (rm_all path) | ||
| (wrap s) | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| #{ | ||
| Calls the rm_all function with a file path as argument. | ||
| #} | ||
|
|
||
| test-io = 1 | ||
|
|
||
| rm_all path = | ||
| (call "RM_ALL" path) | ||
|
|
||
| main = | ||
| let temp = "./temp.txt" | ||
| with IO { | ||
| ask * = (IO/FS/write_file temp (String/encode_utf8 "Contents")) | ||
| ask s = (rm_all temp) | ||
| (wrap s) | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| #{ | ||
| Creates the following tree structure and then removes A and its children. | ||
| A | ||
| |-- a.txt | ||
| |-- AA | ||
| | `-- aa.txt | ||
| `-- AB | ||
| `-- ab.txt | ||
| #} | ||
|
|
||
| test-io = 1 | ||
|
|
||
| mkdir path = | ||
| (call "MKDIR" path) | ||
|
|
||
| rm_all path = | ||
| (call "RM_ALL" path) | ||
|
|
||
| test = | ||
| with IO { | ||
| ask * = (mkdir "A") | ||
| ask * = (mkdir "A/AA") | ||
| ask * = (mkdir "A/AB") | ||
| ask * = (IO/FS/write_file "A/a.txt" (String/encode_utf8 "a")) | ||
| ask * = (IO/FS/write_file "A/AA/aa.txt" (String/encode_utf8 "aa")) | ||
| ask * = (IO/FS/write_file "A/AB/ab.txt" (String/encode_utf8 "ab")) | ||
| ask s = (rm_all "./A") | ||
| (wrap s) | ||
| } | ||
|
|
||
| main = | ||
| with IO { | ||
| ask res = (test) | ||
| (wrap res) | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| #{ | ||
| Uses the rm function to remove an empty directory. | ||
| #} | ||
|
|
||
| test-io = 1 | ||
|
|
||
| mkdir path = | ||
| (call "MKDIR" path) | ||
|
|
||
| rm path = | ||
| (call "RM" path) | ||
|
|
||
| main = | ||
| with IO { | ||
| ask * = (mkdir "temp") | ||
| ask s = (rm "temp") | ||
| (wrap s) | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| #{ | ||
| Creates a temporary file and then removes it. | ||
| #} | ||
|
|
||
| test-io = 1 | ||
|
|
||
| rm path = | ||
| (call "RM" path) | ||
|
|
||
| main = | ||
| let path = "./temp.txt" | ||
| with IO { | ||
| ask * = (IO/FS/write_file path (String/encode_utf8 "Contents")) | ||
| ask s = (rm path) | ||
| (wrap s) | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| #{ | ||
| Tries to remove a non existing file. | ||
| #} | ||
|
|
||
| test-io = 1 | ||
|
|
||
| rm path = | ||
| (call "RM" path) | ||
|
|
||
| main = | ||
| use path = "./non_existing.txt" | ||
| with IO { | ||
| ask s = (rm path) | ||
| (wrap s) | ||
| } |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.