-
Notifications
You must be signed in to change notification settings - Fork 323
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
Implement recursive
argument for File.delete
#9719
Conversation
group_builder.specify "should not allow to create a directory inside of a regular file" <| | ||
test_file = test_root.get / "test_file.json" | ||
test_file.exists . should_be_true | ||
|
||
r = test_file.create_directory "my_test_dir" | ||
r.should_fail_with Illegal_Argument | ||
|
||
# TODO expand with #8993 | ||
group_builder.specify "should delete all contents of a directory when deleting a directory" <| | ||
dir1 = test_root.get.create_directory "my_test_dir1"+(Random.uuid.take 5) | ||
dir1.should_succeed | ||
|
||
dir2 = dir1.create_directory "my_test_dir2" | ||
dir2.should_succeed | ||
|
||
dir1.delete . should_succeed | ||
|
||
Test.with_retries <| | ||
dir1.exists . should_be_false | ||
# The inner directory should also have been trashed if its parent is removed | ||
dir2.exists . should_be_false | ||
|
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.
These tests were replaced with Local_File_Spec.add_create_and_delete_directory_specs
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.
I recommend to look at these changes with 'Hide whitespace changes'
delete : Boolean -> Nothing | ||
delete self (recursive : Boolean = False) = | ||
# TODO improve recursive deletion for S3 folders: https://github.com/enso-org/enso/issues/9704 | ||
if self.is_directory then Error.throw (S3_Error.Error "Deleting S3 folders is currently not implemented." self.uri) else |
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.
It looks like S3 folder deletion is implemented in delete_if_exists
, why is it different here?
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.
Good point, I removed that and rephrased the TODO
This reverts commit e284d7c
Pull Request Description
recursive
option forFile.delete
#8993Important Notes
Checklist
Please ensure that the following checklist has been satisfied before submitting the PR:
Scala,
Java,
and
Rust
style guides. In case you are using a language not listed above, follow the Rust style guide.
./run ide build
.