Fix non-ansi directory
This commit is contained in:
parent
115129464e
commit
2da7f989d7
@ -209,7 +209,7 @@ namespace renderer
|
|||||||
ImGui_ImplDX12_CreateDeviceObjects();
|
ImGui_ImplDX12_CreateDeviceObjects();
|
||||||
ImGui::GetIO().ImeWindowHandle = window;
|
ImGui::GetIO().ImeWindowHandle = window;
|
||||||
|
|
||||||
static const std::string imguiPath = (util::GetCurrentPath() / "imgui.ini").string();
|
static const std::string imguiPath = (util::GetCurrentPathUTF8() / "imgui.ini").string();
|
||||||
ImGui::GetIO().IniFilename = imguiPath.c_str();
|
ImGui::GetIO().IniFilename = imguiPath.c_str();
|
||||||
io.SetPlatformImeDataFn = nullptr; // F**king bug take 4 hours of my life
|
io.SetPlatformImeDataFn = nullptr; // F**king bug take 4 hours of my life
|
||||||
}
|
}
|
||||||
@ -222,7 +222,7 @@ namespace renderer
|
|||||||
ImGui::CreateContext();
|
ImGui::CreateContext();
|
||||||
ImGuiIO& io = ImGui::GetIO(); (void)io;
|
ImGuiIO& io = ImGui::GetIO(); (void)io;
|
||||||
io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard;
|
io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard;
|
||||||
static const std::string imguiPath = (util::GetCurrentPath() / "imgui.ini").string();
|
static const std::string imguiPath = (util::GetCurrentPathUTF8() / "imgui.ini").string();
|
||||||
io.IniFilename = imguiPath.c_str();
|
io.IniFilename = imguiPath.c_str();
|
||||||
|
|
||||||
LoadCustomFont();
|
LoadCustomFont();
|
||||||
|
@ -69,6 +69,14 @@ namespace util
|
|||||||
return std::filesystem::path(pathOut).parent_path().string();
|
return std::filesystem::path(pathOut).parent_path().string();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string GetModulePathUTF8(HMODULE hModule /*= nullptr*/)
|
||||||
|
{
|
||||||
|
wchar_t pathOut[MAX_PATH] = {};
|
||||||
|
GetModuleFileNameW(hModule, pathOut, MAX_PATH);
|
||||||
|
std::wstring_convert<std::codecvt_utf8<wchar_t>> conv;
|
||||||
|
return conv.to_bytes(std::filesystem::path(pathOut).parent_path().wstring());
|
||||||
|
}
|
||||||
|
|
||||||
static std::filesystem::path _currentPath;
|
static std::filesystem::path _currentPath;
|
||||||
void SetCurrentPath(const std::filesystem::path& current_path)
|
void SetCurrentPath(const std::filesystem::path& current_path)
|
||||||
{
|
{
|
||||||
@ -80,6 +88,17 @@ namespace util
|
|||||||
return _currentPath;
|
return _currentPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static std::filesystem::path _currentPathUTF8;
|
||||||
|
void SetCurrentPathUTF8(const std::filesystem::path& current_path)
|
||||||
|
{
|
||||||
|
_currentPathUTF8 = current_path;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::filesystem::path GetCurrentPathUTF8()
|
||||||
|
{
|
||||||
|
return _currentPathUTF8;
|
||||||
|
}
|
||||||
|
|
||||||
std::optional<std::string> SelectDirectory(const char* title)
|
std::optional<std::string> SelectDirectory(const char* title)
|
||||||
{
|
{
|
||||||
auto currPath = std::filesystem::current_path();
|
auto currPath = std::filesystem::current_path();
|
||||||
|
@ -38,10 +38,14 @@ namespace util
|
|||||||
int64_t GetCurrentTimeMillisec();
|
int64_t GetCurrentTimeMillisec();
|
||||||
|
|
||||||
std::string GetModulePath(HMODULE hModule = nullptr);
|
std::string GetModulePath(HMODULE hModule = nullptr);
|
||||||
|
std::string GetModulePathUTF8(HMODULE hModule = nullptr);
|
||||||
|
|
||||||
void SetCurrentPath(const std::filesystem::path& curren_path);
|
void SetCurrentPath(const std::filesystem::path& current_path);
|
||||||
std::filesystem::path GetCurrentPath();
|
std::filesystem::path GetCurrentPath();
|
||||||
|
|
||||||
|
void SetCurrentPathUTF8(const std::filesystem::path& current_path);
|
||||||
|
std::filesystem::path GetCurrentPathUTF8();
|
||||||
|
|
||||||
std::vector<std::string> StringSplit(const std::string& delimiter, const std::string& content);
|
std::vector<std::string> StringSplit(const std::string& delimiter, const std::string& content);
|
||||||
std::string SplitWords(const std::string& value);
|
std::string SplitWords(const std::string& value);
|
||||||
std::string MakeCapital(std::string value);
|
std::string MakeCapital(std::string value);
|
||||||
|
@ -15,6 +15,7 @@ void Run(HMODULE* phModule)
|
|||||||
{
|
{
|
||||||
ResourceLoader::SetModuleHandle(*phModule);
|
ResourceLoader::SetModuleHandle(*phModule);
|
||||||
util::SetCurrentPath(util::GetModulePath(*phModule));
|
util::SetCurrentPath(util::GetModulePath(*phModule));
|
||||||
|
util::SetCurrentPathUTF8(util::GetModulePathUTF8(*phModule));
|
||||||
|
|
||||||
// Init config
|
// Init config
|
||||||
config::Initialize((util::GetCurrentPath() / "cfg.json").string());
|
config::Initialize((util::GetCurrentPath() / "cfg.json").string());
|
||||||
|
Loading…
Reference in New Issue
Block a user