From 99641c468f7c9c477ae84b19ebc0342d574b2261 Mon Sep 17 00:00:00 2001 From: Brian Cox Date: Sat, 23 Sep 2017 13:19:40 -0700 Subject: [PATCH] Add a platform macro indicating whether OS lets temp files be unlinked while open --- src/core/file_unix.cpp | 4 ++-- src/core/platform.h | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/core/file_unix.cpp b/src/core/file_unix.cpp index 963bc9e..8144aa0 100644 --- a/src/core/file_unix.cpp +++ b/src/core/file_unix.cpp @@ -94,7 +94,7 @@ cFile_i::~cFile_i() fclose( mpCurrStream ); mpCurrStream = NULL; -#if IS_AROS || IS_RISCOS +#if !CAN_UNLINK_WHILE_OPEN // so unlink after close instead if( mFlags & cFile::OPEN_LOCKED_TEMP ) { // unlink this file @@ -209,7 +209,7 @@ void cFile::Open( const TSTRING& sFileNameC, uint32 flags ) } mpData->m_fd = fh; -#if !IS_AROS && !IS_RISCOS +#if CAN_UNLINK_WHILE_OPEN if( flags & OPEN_LOCKED_TEMP ) { // unlink this file diff --git a/src/core/platform.h b/src/core/platform.h index 87a904f..7faeb7e 100644 --- a/src/core/platform.h +++ b/src/core/platform.h @@ -328,6 +328,9 @@ #define SUPPORTS_TERMIOS (!IS_RTEMS && !IS_REDOX) // RTEMS errors are probably just a buildsys issue & this will change or go away. +// Redox will probably implement this in the future. + +#define CAN_UNLINK_WHILE_OPEN (!IS_AROS && !IS_RISCOS && !IS_REDOX) #define SUPPORTS_DOUBLE_SLASH_PATH (IS_CYGWIN) // POSIX standard says paths beginning with 2 slashes are "implementation defined"