tempfile
tempfile copied to clipboard
Add parameter for not restricting access to the named tempfile
Fixes #30.
This is just a PoC right now, will fix the warnings etc. if this can get merged in one way or another.
What do you think about this approach? I couldn't find a way to reset file permissions to default on unixy systems after having opened the file.
This would fix my problem with #30, as I'd like to persist the temporary files to normal files after being done writing to them.
Sounds reasonable. However, I'd rather accept an std::fs::Permissions object as that's more general and cross platform. Would that work?
Hm. There doesn't seem to be a way to open a file with a given Permissions struct. The struct is opaque except for the readonly bit which isn't helpful in this case (and the mode on unixy systems). This means we could currently only support setting the mode on new files on unixy systems (not even Redox, and certainly not on Windows). I don't think taking a Permissions struct would improve this API.
Gah. I keep not posting my replies.
You're absolutely correct, that's unfortunate.
So, thinking about this, I'm fine with this approach. I'd rather have a more general approach but... the only API this touches is the builder. Given that, I'm fine going ahead with this.
Fixed warnings, added some documentation, added a test.
Yay, now even compiles on Windows. It's good to go from my side now. :)
This is still going to need Windows and, preferably, directory support.
Any progress on this? I want this feature too. @tbu- Do you mind if I work on a new pull request?
@quark-zju Feel free to redo this. :)
Cross-referencing from https://github.com/Stebalien/tempfile/issues/114: on Linux though it would be helpful to be able to pass a proper Permissions argument.
Fixed in #273.