Christian Ridderström <[EMAIL PROTECTED]> writes: | On Sat, 10 Jan 2004, Angus Leeming wrote: > >> However, the real change I would like is in the implementation. I >> would like to 'unlink' the generated temporary file. It's a royal >> PITA in my view and the function name offers no suggestion that it'll >> generate a file; that's just an implementation detail in my view. >> >> So, my fs::path version of tempName is: >> >> fs::path const tempName(fs::path const & dir, >> string const & prefix, string const & suffix) >> { >> string const temp = tempName(dir.native_file_string(), prefix); >> // Remove the temp file, we only want the name... >> unlink(temp); >> // Append the suffix; >> return fs::path(temp + suffix, fs::native); >> } >> >> Is anybody unhappy with this change?
yes a bit. | The following might be a minuscule problem: > | unlink() deletes the file right? | So if the temporary file was created in e.g. /tmp, theoretically some | other process might "steal" the name if it's been deleted? Right. By deleting the file you are removing the point in using mkstemp. also... is the correct solutoin to use fs::native or is fs::nocheck perhaps better? -- Lgb