Skip to content
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

An additional Argument for File.delete #3651

Closed
prko opened this issue Apr 7, 2018 · 4 comments · Fixed by #3921
Closed

An additional Argument for File.delete #3651

prko opened this issue Apr 7, 2018 · 4 comments · Fixed by #3921
Labels
comp: class library SC class library good first issue indicates issue tickets that are suitable for a new contributor
Milestone

Comments

@prko
Copy link
Contributor

prko commented Apr 7, 2018

Hi,

I have noticed that File.delete("pathName") only deletes an empty folder.

File.mkdir(PathName(thisProcess.nowExecutingPath).parentPath+/+"test")

File.delete(PathName(thisProcess.nowExecutingPath).parentPath+/+"test")
// it posts "-> true" in the post window and deletes the folder "test".

Would it be not useful if we have an additional argument to delete a folder which is not empty?

File.delete(pathName, delete_a_not_empty_folder: 0)
// the second argument: delete_a_not_empty_folder
// 0: default. File.delete deletes only an empty folder.
// 1: File.delete deletes not only an empty folder but also an not empty folder.

e.g.:

File.mkdir(PathName(thisProcess.nowExecutingPath).parentPath+/+"test1/test2")
// File.mkdir can make even a folder in a not existing folder!

File.delete(PathName(thisProcess.nowExecutingPath).parentPath+/+"test1")
// will not delete the folder "test1".

File.delete(PathName(thisProcess.nowExecutingPath).parentPath+/+"test1", 1)
// will delete the folder "test1" as well as the folder "test2".
@mossheim mossheim added the comp: class library SC class library label Apr 8, 2018
@mossheim mossheim added this to the future milestone Apr 8, 2018
@mossheim
Copy link
Contributor

mossheim commented Apr 8, 2018

I would be in favor of this. No preference atm but it could also be implemented as a new deleteAll method.

@telephon
Copy link
Member

telephon commented Apr 8, 2018

yes, deleteAll would be good.

@prko
Copy link
Contributor Author

prko commented Apr 11, 2018

Yes, .deleteAll would be also good!

@mossheim mossheim added the good first issue indicates issue tickets that are suitable for a new contributor label Jul 28, 2018
@redFrik
Copy link
Contributor

redFrik commented Aug 3, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comp: class library SC class library good first issue indicates issue tickets that are suitable for a new contributor
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants