Skip to content
Snippets Groups Projects
Verified Commit 36a70784 authored by Tobias Frisch's avatar Tobias Frisch
Browse files

[#100] Fix for Windows being special of course

parent 27780b2d
Branches
Tags
No related merge requests found
Pipeline #26413 failed
...@@ -2,7 +2,14 @@ ...@@ -2,7 +2,14 @@
#include "vkcv/File.hpp" #include "vkcv/File.hpp"
#include <stdlib.h> #include <stdlib.h>
#ifdef _WIN32
#else
#include <unistd.h> #include <unistd.h>
#endif
#include "vkcv/Logger.hpp"
namespace vkcv { namespace vkcv {
...@@ -15,13 +22,25 @@ namespace vkcv { ...@@ -15,13 +22,25 @@ namespace vkcv {
} }
char name [16] = "vkcv_tmp_XXXXXX"; char name [16] = "vkcv_tmp_XXXXXX";
#ifdef _WIN32
int err = _mktemp_s(name, 16)
if (err != 0) {
vkcv_log(LogLevel::ERROR, "Temporary file path could not be generated");
return "";
}
#else
int fd = mkstemp(name); int fd = mkstemp(name);
if (fd == -1) { if (fd == -1) {
vkcv_log(LogLevel::ERROR, "Temporary file path could not be generated");
return ""; return "";
} }
close(fd); close(fd);
#endif
return tmp / name; return tmp / name;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment