mirror of
https://github.com/luanti-org/luanti.git
synced 2025-08-11 17:51:04 +00:00
Dynamic_Add_Media v2 (#11550)
This commit is contained in:
parent
bcb6565483
commit
bbfae0cc67
19 changed files with 796 additions and 246 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue