diff options
author | sfan5 <sfan5@live.de> | 2021-09-09 16:51:35 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-09 16:51:35 +0200 |
commit | bbfae0cc673d3abdc21224c53e09b209ee4688a2 (patch) | |
tree | e1afb8f64570b212d3db53a975b59fff5af67ad8 /src/filesys.cpp | |
parent | bcb65654836caffa670a611ff7c79b0705a40c3c (diff) | |
download | minetest-bbfae0cc673d3abdc21224c53e09b209ee4688a2.tar.xz |
Dynamic_Add_Media v2 (#11550)
Diffstat (limited to 'src/filesys.cpp')
-rw-r--r-- | src/filesys.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/filesys.cpp b/src/filesys.cpp index 99b030624..0941739b8 100644 --- a/src/filesys.cpp +++ b/src/filesys.cpp @@ -21,8 +21,10 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "util/string.h" #include <iostream> #include <cstdio> +#include <cstdlib> #include <cstring> #include <cerrno> +#include <unistd.h> #include <fstream> #include "log.h" #include "config.h" @@ -811,5 +813,15 @@ bool Rename(const std::string &from, const std::string &to) return rename(from.c_str(), to.c_str()) == 0; } +std::string CreateTempFile() +{ + std::string path = TempPath() + DIR_DELIM "MT_XXXXXX"; + int fd = mkstemp(&path[0]); // modifies path + if (fd == -1) + return ""; + close(fd); + return path; +} + } // namespace fs |