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 suffix kwarg to tempname #53474

Merged
merged 2 commits into from
Feb 26, 2024

Conversation

IanButterworth
Copy link
Member

tempname checks that the name its returning is not already a file, however if you want that filename to contain other information, like a file extension, that can mean the uniquing isn't complete.

This adds tempname(suffix = "_foo.txt") to include a suffix in the name and uniquing check.

Copy link
Member

@vtjnash vtjnash left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SGTM. I think this used to rely on the libc function, which does not support suffixes (mkstemps is non-portable though usually available). Now we implement without libc, so this seems good

NEWS.md Outdated Show resolved Hide resolved
Co-authored-by: Jameson Nash <[email protected]>
@IanButterworth IanButterworth merged commit a796a41 into JuliaLang:master Feb 26, 2024
6 of 7 checks passed
@IanButterworth IanButterworth deleted the ib/tempname_suffix branch February 26, 2024 19:52
tecosaur pushed a commit to tecosaur/julia that referenced this pull request Mar 4, 2024
`tempname` checks that the name its returning is not already a file,
however if you want that filename to contain other information, like a
file extension, that can mean the uniquing isn't complete.

This adds `tempname(suffix = "_foo.txt")` to include a suffix in the
name and uniquing check.

---------

Co-authored-by: Jameson Nash <[email protected]>
mkitti pushed a commit to mkitti/julia that referenced this pull request Mar 7, 2024
`tempname` checks that the name its returning is not already a file,
however if you want that filename to contain other information, like a
file extension, that can mean the uniquing isn't complete.

This adds `tempname(suffix = "_foo.txt")` to include a suffix in the
name and uniquing check.

---------

Co-authored-by: Jameson Nash <[email protected]>
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

Successfully merging this pull request may close these issues.

2 participants