#include <config.h>
#include "support/lyxlib.h"
+
+#include "support/convert.h"
#include "support/filetools.h"
-#include "support/tostr.h"
-#include "support/os.h"
+#include "support/package.h"
#include "debug.h"
#include <boost/scoped_array.hpp>
#include <cstdlib>
-#include <unistd.h>
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if !defined(HAVE_MKSTEMP) && defined(HAVE_MKTEMP)
+# include <fcntl.h>
+# include <sys/stat.h>
+#endif
using boost::scoped_array;
string const lyx::support::tempName(string const & dir, string const & mask)
{
- string const tmpdir(dir.empty() ? os::getTmpDir() : dir);
+ string const tmpdir(dir.empty() ? package().temp_dir() : dir);
string tmpfl(AddName(tmpdir, mask));
- tmpfl += tostr(getpid());
+ tmpfl += convert<string>(getpid());
tmpfl += "XXXXXX";
// The supposedly safe mkstemp version