mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-11 07:12:02 +00:00
Changed tmpfileplus() to our needs
Removed exclusive flag, made it C++ friendly, replaced unlink() with remove()
This commit is contained in:
parent
e60c6d35c3
commit
e6c9ccf3a1
2 changed files with 11 additions and 3 deletions
|
@ -200,13 +200,13 @@ static FILE *mktempfile_internal(const char *tmpdir, const char *pfx, char **tmp
|
|||
*/
|
||||
#ifdef _WIN32
|
||||
/* MSVC flags */
|
||||
oflag = _O_BINARY|_O_CREAT|_O_EXCL|_O_RDWR;
|
||||
oflag = _O_BINARY|_O_CREAT|_O_RDWR;
|
||||
if (!keep)
|
||||
oflag |= _O_TEMPORARY;
|
||||
pmode = _S_IREAD | _S_IWRITE;
|
||||
#else
|
||||
/* Standard POSIX flags */
|
||||
oflag = O_CREAT|O_EXCL|O_RDWR;
|
||||
oflag = O_CREAT|O_RDWR;
|
||||
pmode = S_IRUSR|S_IWUSR;
|
||||
#endif
|
||||
|
||||
|
@ -239,7 +239,7 @@ static FILE *mktempfile_internal(const char *tmpdir, const char *pfx, char **tmp
|
|||
|
||||
#ifndef _WIN32
|
||||
/* [Unix only] And make sure the file will be deleted once closed */
|
||||
if (!keep) unlink(tmpname);
|
||||
if (!keep) remove(tmpname);
|
||||
#endif
|
||||
|
||||
}
|
||||
|
|
|
@ -23,6 +23,10 @@
|
|||
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/** Create a unique temporary file.
|
||||
@param dir (optional) directory to create file. If NULL use default TMP directory.
|
||||
@param prefix (optional) prefix for file name. If NULL use "tmp.".
|
||||
|
@ -50,4 +54,8 @@ FILE *tmpfileplus_f(const char *dir, const char *prefix, char *pathnamebuf, size
|
|||
|
||||
#define TMPFILE_KEEP 1
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* end TMPFILEPLUS_H_ */
|
||||
|
|
Loading…
Reference in a new issue