From b985f87a77a11594eb932c20d7374aa8ef9617e7 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Wed, 27 Jan 2016 22:57:31 +0100 Subject: [PATCH] Use proper UTF8 file-names during export. --- libs/audiographer/private/sndfile.hh | 31 ++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/libs/audiographer/private/sndfile.hh b/libs/audiographer/private/sndfile.hh index 02e8651f60..8b7e1928e4 100644 --- a/libs/audiographer/private/sndfile.hh +++ b/libs/audiographer/private/sndfile.hh @@ -52,6 +52,13 @@ #ifndef SNDFILE_HH #define SNDFILE_HH +#include +#include +#include + +#include +#include "pbd/gstdio_compat.h" + #include #include @@ -182,7 +189,17 @@ SndfileHandle::SndfileHandle (const char *path, int mode, int fmt, int chans, in p->sfinfo.sections = 0 ; p->sfinfo.seekable = 0 ; - p->sf = sf_open (path, mode, &p->sfinfo) ; + bool writable = false; + if (mode & SFM_WRITE) { + writable = true; + } +#ifdef PLATFORM_WINDOWS + int fd = g_open (path, writable ? O_CREAT | O_RDWR : O_RDONLY, writable ? 0644 : 0444); +#else + int fd = ::open (path, writable ? O_CREAT | O_RDWR : O_RDONLY, writable ? 0644 : 0444); +#endif + + p->sf = sf_open_fd (fd, mode, &p->sfinfo, true) ; } ; return ; @@ -204,7 +221,17 @@ SndfileHandle::SndfileHandle (std::string const & path, int mode, int fmt, int c p->sfinfo.sections = 0 ; p->sfinfo.seekable = 0 ; - p->sf = sf_open (path.c_str (), mode, &p->sfinfo) ; + bool writable = false; + if (mode & SFM_WRITE) { + writable = true; + } +#ifdef PLATFORM_WINDOWS + int fd = g_open (path.c_str(), writable ? O_CREAT | O_RDWR : O_RDONLY, writable ? 0644 : 0444); +#else + int fd = ::open (path.c_str(), writable ? O_CREAT | O_RDWR : O_RDONLY, writable ? 0644 : 0444); +#endif + + p->sf = sf_open_fd (fd, mode, &p->sfinfo, true) ; } ; return ;