-
Notifications
You must be signed in to change notification settings - Fork 9
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
Fix the 'memfs' example to pass the tests #17
base: master
Are you sure you want to change the base?
Conversation
dokan/examples/memfs/main.rs
Outdated
if create_options & FILE_DIRECTORY_FILE > 0 { | ||
if let Some(stream_info) = &name.stream_info { | ||
if !stream_info.check_default(true)? { | ||
Err(STATUS_NOT_A_DIRECTORY)?; |
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.
Should this return ?
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.
Yes, we should return an error if the directory has streams (except for the default stream ':$I30:$INDEX_ALLOCATION'). I could insert this check elsewhere (for exp, line 532), but then it would have to be inserted in multiple places, for different operations (CreateDirectory, RemoveDirectory, etc)
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 I meant that I believe return
is missing before Err(STATUS_NOT_A_DIRECTORY)?;
?
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.
Ah, I see. In Rust, the expressions return Err(...);
and Err(...)?;
are equivalent. I didn't see in the Rust guidelines which option is recommended to use. I've seen both usages in other rust projects. Overall you are right, I will change this to make the code more consistent.
Fix #16
Also, see discussion