From eb020a765b3ce5aace4f9bf162b550523dcfe124 Mon Sep 17 00:00:00 2001 From: "Charles J. Cliffe" Date: Mon, 22 Feb 2016 18:43:58 -0500 Subject: [PATCH] MSVC resource patch from @guruofquality #276 --- src/util/GLFont.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/util/GLFont.cpp b/src/util/GLFont.cpp index 76d1cb1..33cea52 100644 --- a/src/util/GLFont.cpp +++ b/src/util/GLFont.cpp @@ -4,6 +4,25 @@ #include #include +#ifdef _MSC_VER +#include + +static std::string getExePath(void) +{ + HMODULE hModule = GetModuleHandle(NULL); + char path[MAX_PATH]; + GetModuleFileNameA(hModule, path, MAX_PATH); + + char drive[_MAX_DRIVE]; + char dir[_MAX_DIR]; + char fname[_MAX_FNAME]; + char ext[_MAX_EXT]; + _splitpath_s(path, drive, dir, fname, ext); + + return std::string(drive) + std::string(dir); +} +#endif + #ifndef RES_FOLDER #define RES_FOLDER "" #endif @@ -158,6 +177,9 @@ std::string GLFont::getParamValue(std::string param_str) { void GLFont::loadFont(std::string fontFile) { std::string resourceFolder = RES_FOLDER; + #ifdef _MSC_VER + resourceFolder = getExePath() + "/" + resourceFolder; + #endif wxFileName fontFileName = wxFileName(resourceFolder, fontFile);