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

[class library] new _FileDeleteAll primitive #3921

Merged
merged 1 commit into from
Aug 9, 2018

Conversation

mkb218
Copy link
Contributor

@mkb218 mkb218 commented Jul 31, 2018

Purpose and Motivation

Recursive delete of a pathname. Fixes #3651.

Types of changes

  • New feature (non-breaking change which adds functionality)

Checklist

  • All tests are passing
  • If necessary, new tests were created to address changes in PR (and tests are passing)
  • Updated documentation, if necessary

  • This PR is ready for review

@mossheim
Copy link
Contributor

mossheim commented Aug 3, 2018

Thanks @mkb218 ! This code is clear and stylistically perfect.

My concern with this approach is that any error message coming from remove_all is hidden. To make this method orthogonal with the other File operations, I'd recommend:

  • use the non-error_code version of remove_all, so that encountered errors will be caught and reported by the runtime
  • set the return value using the bool return value of remove_all.

I think this addition is fine without a test; we currently don't test filesystem operations and I think unless we run into anything significantly annoying, it's more trouble than it's worth. So I've marked this as OK on the test requirement.

Please also add documentation in HelpSource/Classes/File.schelp.

If you have any questions, let me know!

@mossheim mossheim added comp: sclang sclang C++ implementation (primitives, etc.). for changes to class lib use "comp: class library" comp: class library SC class library labels Aug 3, 2018
@mkb218 mkb218 force-pushed the topic-deleteall-primitive branch from d389566 to db41f66 Compare August 3, 2018 20:05
@mkb218
Copy link
Contributor Author

mkb218 commented Aug 3, 2018

I think I've implemented your recommendations, but now this method's return value is inconsistent with File.delete

@mossheim
Copy link
Contributor

mossheim commented Aug 4, 2018

@mkb218 That's fine, thanks for the changes! Could you also update the documentation with information about the error throwing conditions?

@mossheim
Copy link
Contributor

mossheim commented Aug 4, 2018

Overall looks good, but I think you accidentally committed some changes to hidapi as well, can you please revert that and then I'll approve this?

@mkb218
Copy link
Contributor Author

mkb218 commented Aug 4, 2018

Oops! Hang on while I try to get git to forget about that.

@mkb218
Copy link
Contributor Author

mkb218 commented Aug 7, 2018

OK, I think this is ready!

nhthn
nhthn previously requested changes Aug 8, 2018
Copy link
Contributor

@nhthn nhthn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks! sorry, but could you rebase to get rid of the revert commits?

@mkb218
Copy link
Contributor Author

mkb218 commented Aug 8, 2018

No problem! I'll just squash it into a single commit?

@nhthn
Copy link
Contributor

nhthn commented Aug 8, 2018

yes, i think that would be appropriate here.

Copy link
Contributor

@mossheim mossheim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks!

return error;

const bfs::path& p = SC_Codecvt::utf8_str_to_path(filename);
if (bfs::remove_all(p) > 0) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn't realize this returns a uint - I was reading the doc for remove by mistake!

@mkb218 mkb218 force-pushed the topic-deleteall-primitive branch from 4b1a2dc to c9d9f21 Compare August 8, 2018 13:30
@mkb218
Copy link
Contributor Author

mkb218 commented Aug 8, 2018

@snappizz should be all set now

@mossheim mossheim dismissed nhthn’s stale review August 9, 2018 00:41

Concerns have been addressed.

@mossheim mossheim merged commit 4fd1b99 into supercollider:develop Aug 9, 2018
@prko
Copy link
Contributor

prko commented Aug 9, 2018

thank you!

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 comp: sclang sclang C++ implementation (primitives, etc.). for changes to class lib use "comp: class library"
Projects
None yet
Development

Successfully merging this pull request may close these issues.

An additional Argument for File.delete
4 participants