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

FILE_FLAG_DELETE_ON_CLOSE isn't possible to have set on named tempfiles #277

Open
bwoebi opened this issue Feb 6, 2024 · 2 comments
Open

Comments

@bwoebi
Copy link

bwoebi commented Feb 6, 2024

It would be great it if it were possible to have some API where I can pass a prefix / name ending up with a self-deleting temp file.

I suppose for most use cases this doesn't matter, but I tried to use a well-known prefix, for two reasons:

a) finding the file in Resource Monitor for debugging
b) naming a temporary executable so that it can be trivially identified in task manager.

@Stebalien
Copy link
Owner

This would likely mean two functions:

  1. tempfile_with_prefix
  2. tempfile_with_prefix_in

It's not truly cross-platform as the prefix would make no sense on Linux, but I'm open to it as long as we document that fact. As you say, this is only for debugging anyways.

@dwattttt
Copy link

dwattttt commented Mar 6, 2024

I'll also chime in here with a use case; I'm using a tempfile to hold downloaded data that's then processed by an external tool, wiping the file/data after it's done. The problem is that the external tool does detection based on the file's suffix, so I have to lose FILE_FLAG_DELETE_ON_CLOSE (or as a workaround use a common filename in a temp dir).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants