From ccf5a7e80f89448a5c2be2540ef69040f0346d40 Mon Sep 17 00:00:00 2001 From: Person Date: Wed, 2 May 2018 18:23:26 -0700 Subject: [PATCH] --Bug fixes -Allow running from outside of the folder the executable is in on Windows, by adding the install folder to the PATH variable. This was needed to properly find the palette file (even though it's mostly unneeded). --- Source/EmberCommon/EmberCommon.h | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/Source/EmberCommon/EmberCommon.h b/Source/EmberCommon/EmberCommon.h index cb89de8..9faba60 100644 --- a/Source/EmberCommon/EmberCommon.h +++ b/Source/EmberCommon/EmberCommon.h @@ -124,14 +124,22 @@ template static bool InitPaletteList(const string& filename) { auto paletteList = PaletteList::Instance(); +#ifdef _WIN32 + vector fullpath; + fullpath.resize(2048); + GetModuleFileName(nullptr, fullpath.data(), fullpath.size()); + string s = GetPath(string(fullpath.data())); +#else + string s = "./"; +#endif static vector paths = { - "./" + s #ifndef _WIN32 - , "~", - "~/.config/fractorium", - "/usr/share/fractorium", - "/usr/local/share/fractorium" + , "~/", + "~/.config/fractorium/", + "/usr/share/fractorium/", + "/usr/local/share/fractorium/" #endif }; bool added = false; @@ -139,7 +147,7 @@ static bool InitPaletteList(const string& filename) for (auto& p : paths) { if (!added) - added |= paletteList->Add(p + "/" + filename); + added |= paletteList->Add(p + filename); else break; }