App: issue #7112: Addon manager does not work on windows with special characters in the username

This commit is contained in:
wmayer
2022-06-29 11:25:06 +02:00
parent 448b1ec9f3
commit 22829f8a24

View File

@@ -23,6 +23,7 @@
#include "PreCompiled.h"
#include "Metadata.h"
#include <Base/FileInfo.h>
// inclusion of the generated files (generated out of MetadataPy.xml)
#include "MetadataPy.h"
@@ -64,10 +65,13 @@ int MetadataPy::PyInit(PyObject* args, PyObject* /*kwd*/)
// Main class constructor -- takes a file path, loads the metadata from it
PyErr_Clear();
const char* filename;
if (PyArg_ParseTuple(args, "s", &filename)) {
char* filename;
if (PyArg_ParseTuple(args, "et", "utf-8", &filename)) {
try {
auto md = new Metadata(filename);
std::string utf8Name = std::string(filename);
PyMem_Free(filename);
auto md = new Metadata(Base::FileInfo::stringToPath(utf8Name));
setTwinPointer(md);
return 0;
}