-
Notifications
You must be signed in to change notification settings - Fork 82
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
[FEATURE] Allow overwrite existing files, add flags for permission handling #2009
[FEATURE] Allow overwrite existing files, add flags for permission handling #2009
Conversation
497ff94
to
b4ad152
Compare
Codecov Report
@@ Coverage Diff @@
## master #2009 +/- ##
=======================================
Coverage 97.95% 97.96%
=======================================
Files 264 264
Lines 10045 10050 +5
=======================================
+ Hits 9840 9845 +5
Misses 205 205
Continue to review full report at Codecov.
|
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.
Thank you for this draft PR! I agree with the implementation and the tests are actually good (they cover all combinations of file formats and the boolean flag). I think after cleaning up the comments you can switch it to a "real" PR.
@@ -600,10 +600,16 @@ template <typename file_t = void> | |||
class output_file_validator : public file_validator_base | |||
{ | |||
public: | |||
//!\brief Stores, if it is valid to overwrite the output file. | |||
bool allow_overwrite = false; // ToDo: bool oder enum? Für jedes File einzeln entscheiden, also zum Pfad dazugeben? Oder als Vektor angeben? |
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.
append
cannot be implemented with the argument parser, as the user receives the file name and opens the file themself (with or without append flag). So I suggest to only focus on the binary distinction of the output file "may exist or not".
Note: If we would not handle it at all, the decision (of throwing an error if the file exists) could be still be made by the app developer after obtaining the filename.
71b2c62
to
21fa77e
Compare
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.
Mostly documentation ideas...
@@ -575,6 +574,15 @@ class input_file_validator : public file_validator_base | |||
} | |||
}; | |||
|
|||
//!\brief Stores, if it is valid to overwrite the output file. | |||
enum output_file_open_mode |
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.
Question (no need to change, just an opinion):
How about naming it accept_existing_file
?
Because mode
expresses nothing useful about the function of this enum.
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.
Thanks! 👍
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.
Waiting on naming
3fc5b0a
to
85ee726
Compare
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.
first round :)
85ee726
to
7632f75
Compare
Core-Meeting 2020-09-08We want semi-regularity (that means default constructible) and as default case is conservative with |
dda81ea
to
bed6158
Compare
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 didn't go through all test cases. Thank you!
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.
Sorry for being late; This is just some nail polish :)
171f5e5
to
a85540b
Compare
…ermission [TEST] Update validator test [DOC] Update changelog, update (tutorial) documentation and code documentation Signed-off-by: Lydia Buntrock <[email protected]>
a85540b
to
c94d251
Compare
@seqan/core Can we still include this in the current 3.0.2 release or do we have to wait for the next one? I think many applications can already benefit from this. |
…gs for permission handling' PR (seqan#2009) Signed-off-by: Lydia Buntrock <[email protected]>
Resolves seqan/product_backlog#50.
Please do not merge before the naming discussion of the enum on gitter has ended.
Existing Ideas:
enum output_file_open_mode { overwritable / rewritable, exclusive };
There is something in system.io from Microsoft that sounds good: https://docs.microsoft.com/de-de/dotnet/api/system.io.filemode?view=netcore-3.1 :
enum FileMode { open_or_create, create_new };
Rust:
enum OpenOptions { create, create_new };
2020-08-31
Discussion result:
enum output_file_open_options { open_or_create, create_new };
You call this validator like: