]> git.lyx.org Git - features.git/blobdiff - src/support/tempname.cpp
reduce line noise
[features.git] / src / support / tempname.cpp
index ad58752246776c3e5511af8963b53819ce18c884..6c6e998210acbf7337b3ae5f283a96a0d94e717b 100644 (file)
 # include <unistd.h>
 #endif
 
+#if defined(HAVE_MKSTEMP) && ! defined(HAVE_DECL_MKSTEMP)
+extern "C" int mkstemp(char *);
+#endif
+
 #if !defined(HAVE_MKSTEMP) && defined(HAVE_MKTEMP)
 # include <fcntl.h>
 # ifdef HAVE_SYS_STAT_H
@@ -81,9 +85,9 @@ int make_tempfile(char * templ)
 FileName const tempName(FileName const & dir, string const & mask)
 {
        string const tmpdir(dir.empty() ?
-                       package().temp_dir().toFilesystemEncoding() :
-                       dir.toFilesystemEncoding());
-       string tmpfl(addName(tmpdir, mask));
+                       package().temp_dir().absFilename() :
+                       dir.absFilename());
+       string tmpfl(to_filesystem8bit(from_utf8(addName(tmpdir, mask))));
 #if defined (HAVE_GETPID)
        tmpfl += convert<string>(getpid());
 #elif defined (HAVE__GETPID)
@@ -108,15 +112,11 @@ FileName const tempName(FileName const & dir, string const & mask)
 #else
 # error No x() function.
 #endif
-               LYXERR(Debug::FILES) << "Temporary file `" << t
-                                    << "' created." << endl;
+               LYXERR(Debug::FILES, "Temporary file `" << t << "' created.");
                return FileName(t);
-       } else {
-               LYXERR(Debug::FILES)
-                       << "LyX Error: Unable to create temporary file."
-                       << endl;
-               return FileName();
        }
+       LYXERR(Debug::FILES, "LyX Error: Unable to create temporary file.");
+       return FileName();
 }
 
 } // namespace support