11 #include "filetools.h"
15 extern string system_tempdir;
17 string const lyx::tempName(string const & dir, string const & mask)
20 // the tmpnam version...
21 char const * const tmp = ::tmpnam(0);
22 return (tmp) ? tmp : string ();
26 tmpdir = system_tempdir;
29 string tmpfl(AddName(tmpdir, mask));
30 tmpfl += tostr(getpid());
32 // the supposedly safer mkstemp version
33 char * tmpl = new char[256];
35 ::strcpy(tmpl, tmpfl.c_str());
36 int tmpf = ::mkstemp(tmpl);
41 lyxerr << "Temporary file `" << t << "' created." << endl;
44 lyxerr << "LyX Error: Unable to create temporary file."