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

Add is_temp, is_tempfile and is_tempdir predicates #287

Open
bpj opened this issue Oct 14, 2023 · 0 comments
Open

Add is_temp, is_tempfile and is_tempdir predicates #287

bpj opened this issue Oct 14, 2023 · 0 comments

Comments

@bpj
Copy link

bpj commented Oct 14, 2023

Please add is_temp (and is_tempfile and is_tempdir if possible) predicate(s).

They would, of course, return true if the path object represents a temporary file or directory, as determined by whether it contains a File::Temp object.

My use case is that I cache paths to non-temporary files/directories (as strings) to an external YAML file, but skip temp files/dirs so I would like a way to determine whether a path is a temp which doesn't throw if it is not like cached_temp does.

I could of course (and do currently) use Try::Tiny or an eval block but that should ideally involve checking that it dies for the right reason, and that is both a lot of hassle for doing such a thing and a blunt tool.

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

1 participant