tempfile icon indicating copy to clipboard operation
tempfile copied to clipboard

Add parameter for not restricting access to the named tempfile

Open tbu- opened this issue 7 years ago • 11 comments

Fixes #30.

tbu- avatar Jun 22 '18 10:06 tbu-

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.

tbu- avatar Jun 22 '18 10:06 tbu-

Sounds reasonable. However, I'd rather accept an std::fs::Permissions object as that's more general and cross platform. Would that work?

Stebalien avatar Jun 22 '18 17:06 Stebalien

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.

tbu- avatar Jun 23 '18 13:06 tbu-

Gah. I keep not posting my replies.

You're absolutely correct, that's unfortunate.

Stebalien avatar Jul 21 '18 00:07 Stebalien

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.

Stebalien avatar Jul 21 '18 00:07 Stebalien

Fixed warnings, added some documentation, added a test.

tbu- avatar Jul 21 '18 10:07 tbu-

Yay, now even compiles on Windows. It's good to go from my side now. :)

tbu- avatar Jul 21 '18 11:07 tbu-

This is still going to need Windows and, preferably, directory support.

Stebalien avatar Jul 21 '18 15:07 Stebalien

Any progress on this? I want this feature too. @tbu- Do you mind if I work on a new pull request?

quark-zju avatar May 31 '19 23:05 quark-zju

@quark-zju Feel free to redo this. :)

tbu- avatar Jun 01 '19 11:06 tbu-

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.

lucab avatar Jul 16 '20 16:07 lucab

Fixed in #273.

Stebalien avatar Feb 05 '24 18:02 Stebalien