Permalink
Browse files

Fix file name encoding issues with ZynAddSubFX on Windows

  • Loading branch information...
PhysSong committed May 28, 2018
1 parent 792e478 commit 9d0aae2708aed2fc0a18b16f31fef05f2496fd26
Showing with 12 additions and 7 deletions.
  1. +12 −7 plugins/zynaddsubfx/zynaddsubfx/src/Misc/QtXmlWrapper.cpp
@@ -55,10 +55,13 @@
#include <sstream>
#include <cstdarg>
#include <zlib.h>
#include "lmmsconfig.h"
#include "../globals.h"
#include "Util.h"
// Include LMMS headers
#include "lmmsconfig.h"
#include "IoHelper.h"
struct XmlData
{
@@ -193,11 +196,12 @@ int QtXmlWrapper::dosavefile(const char *filename,
int compression,
const char *xmldata) const
{
FILE *file = F_OPEN_UTF8(std::string(filename), "w");
if(file == NULL) {
return -1;
}
if(compression == 0) {
FILE *file;
file = fopen(filename, "w");
if(file == NULL)
return -1;
fputs(xmldata, file);
fclose(file);
}
@@ -210,7 +214,7 @@ int QtXmlWrapper::dosavefile(const char *filename,
snprintf(options, 10, "wb%d", compression);
gzFile gzfile;
gzfile = gzopen(filename, options);
gzfile = gzdopen(fileToDescriptor(file), options);
if(gzfile == NULL)
return -1;
gzputs(gzfile, xmldata);
@@ -313,7 +317,8 @@ int QtXmlWrapper::loadXMLfile(const std::string &filename)
char *QtXmlWrapper::doloadfile(const std::string &filename) const
{
char *xmldata = NULL;
gzFile gzfile = gzopen(filename.c_str(), "rb");
gzFile gzfile = gzdopen(fileToDescriptor(F_OPEN_UTF8(filename, "rb")), "rb");
if(gzfile != NULL) { //The possibly compressed file opened
std::stringstream strBuf; //reading stream

0 comments on commit 9d0aae2

Please sign in to comment.