13
0

Ensure export starts with a clean state

This commit is contained in:
Robin Gareus 2016-02-14 13:23:45 +01:00
parent 0034ecfe49
commit f23bb163a8

View File

@ -193,6 +193,9 @@ SndfileHandle::SndfileHandle (const char *path, int mode, int fmt, int chans, in
if (mode & SFM_WRITE) { if (mode & SFM_WRITE) {
writable = true; writable = true;
} }
if (writable) {
::g_unlink (path);
}
#ifdef PLATFORM_WINDOWS #ifdef PLATFORM_WINDOWS
int fd = g_open (path, writable ? O_CREAT | O_RDWR : O_RDONLY, writable ? 0644 : 0444); int fd = g_open (path, writable ? O_CREAT | O_RDWR : O_RDONLY, writable ? 0644 : 0444);
#else #else
@ -225,6 +228,9 @@ SndfileHandle::SndfileHandle (std::string const & path, int mode, int fmt, int c
if (mode & SFM_WRITE) { if (mode & SFM_WRITE) {
writable = true; writable = true;
} }
if (writable) {
::g_unlink (path.c_str());
}
#ifdef PLATFORM_WINDOWS #ifdef PLATFORM_WINDOWS
int fd = g_open (path.c_str(), writable ? O_CREAT | O_RDWR : O_RDONLY, writable ? 0644 : 0444); int fd = g_open (path.c_str(), writable ? O_CREAT | O_RDWR : O_RDONLY, writable ? 0644 : 0444);
#else #else