Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: dlang/phobos
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 876c720
Choose a base ref
...
head repository: dlang/phobos
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 99aec4e
Choose a head ref
  • 1 commit
  • 1 file changed
  • 1 contributor

Commits on Oct 19, 2017

  1. Issue 17912: Add function for creating a temporary file.

    This adds std.file.createTempFile, which creates a temporary file with a
    random name (optionally with a specified prefix and/or suffix). By
    default, the file is empty, but if data is passed to createTempFile,
    then the file is populated with that data just like it would have been
    with std.file.write. The name of the file that was created is returned.
    So, essentially, createTempFile is like write except that it generates
    the file name for you and returns it.
    
    Previously, we added scratchFile to std.stdio, which was like
    createTempFile except that it gave you an open File object, but it was
    scrapped, because the dependencies that it added to std.stdio made
    "hello world" bigger. See:
    https://issues.dlang.org/show_bug.cgi?id=14599
    
    Just like scratchFile did, createTempFile ensures that a filename is
    selected which did not exist previously so that the file can't be
    hijacked with different permissions by someone creating a file with the
    same name beforehand (the randomness of the name should make that
    effectively impossible, but the way that createTempFile opens the file
    guarantees it).
    
    These changes also consolidate some of write's implementation across
    OSes, since the writing portion of writeImpl was esentially identical
    across OSes but needlessly duplicated. That consolidated functionality
    is then also used by createTempFile.
    jmdavis committed Oct 19, 2017
    Configuration menu
    Copy the full SHA
    99aec4e View commit details
    Browse the repository at this point in the history
Loading