fix loading error when loading from Chinese path
parent
59ea17fe3f
commit
d8f01324d0
|
@ -1,10 +1,3 @@
|
||||||
/*
|
|
||||||
* Vulkan utilities
|
|
||||||
*
|
|
||||||
* Copyright(C) 2018 by Sascha Willems - www.saschawillems.de
|
|
||||||
*
|
|
||||||
* This code is licensed under the MIT license(MIT) (http://opensource.org/licenses/MIT)
|
|
||||||
*/
|
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
|
|
@ -1687,23 +1687,27 @@ PlumageRender::PlumageRender()
|
||||||
// TO DO : language switch
|
// TO DO : language switch
|
||||||
if (gui->header(chineseUI.model)) {
|
if (gui->header(chineseUI.model)) {
|
||||||
if (gui->button(chineseUI.openNewModel)) {
|
if (gui->button(chineseUI.openNewModel)) {
|
||||||
std::string filename = "";
|
std::wstring filename = L"";
|
||||||
char buffer[MAX_PATH];
|
wchar_t buffer[MAX_PATH];
|
||||||
OPENFILENAME ofn;
|
OPENFILENAMEW ofn;
|
||||||
ZeroMemory(&buffer, sizeof(buffer));
|
ZeroMemory(&buffer, sizeof(buffer));
|
||||||
ZeroMemory(&ofn, sizeof(ofn));
|
ZeroMemory(&ofn, sizeof(ofn));
|
||||||
ofn.lStructSize = sizeof(ofn);
|
ofn.lStructSize = sizeof(ofn);
|
||||||
ofn.lpstrFilter = "glTF files\0*.gltf;*.glb\0";
|
ofn.lpstrFilter = L"glTF files\0*.gltf;*.glb\0";
|
||||||
ofn.lpstrFile = buffer;
|
ofn.lpstrFile = buffer;
|
||||||
ofn.nMaxFile = MAX_PATH;
|
ofn.nMaxFile = MAX_PATH;
|
||||||
ofn.lpstrTitle = "Select a glTF file to load";
|
ofn.lpstrTitle = L"Select a glTF file to load";
|
||||||
ofn.Flags = OFN_DONTADDTORECENT | OFN_FILEMUSTEXIST | OFN_NOCHANGEDIR;
|
ofn.Flags = OFN_DONTADDTORECENT | OFN_FILEMUSTEXIST | OFN_NOCHANGEDIR;
|
||||||
if (GetOpenFileNameA(&ofn)) {
|
if (GetOpenFileNameW(&ofn)) {
|
||||||
filename = buffer;
|
filename = buffer;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!filename.empty()) {
|
if (!filename.empty()) {
|
||||||
vkDeviceWaitIdle(device);
|
vkDeviceWaitIdle(device);
|
||||||
loadScene(filename);
|
std::wstring_convert<std::codecvt_utf8<wchar_t>> converter;
|
||||||
|
std::string stringFilename = converter.to_bytes(filename);
|
||||||
|
loadScene(stringFilename);
|
||||||
setupDescriptors();
|
setupDescriptors();
|
||||||
updateCBs = true;
|
updateCBs = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,8 @@
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <io.h>
|
#include <io.h>
|
||||||
|
#include <locale>
|
||||||
|
#include <codecvt>
|
||||||
#include "algorithm"
|
#include "algorithm"
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue