Enable resource lookup for Windows build (needed for dev and MSYS2 package).

master
Torsten Paul 2014-12-25 18:19:26 +01:00
parent fd4fe0816a
commit d2af825640
1 changed files with 10 additions and 3 deletions

View File

@ -25,7 +25,6 @@ static std::string lookupResourcesPath()
fs::path resourcedir(applicationpath); fs::path resourcedir(applicationpath);
PRINTDB("Looking up resource folder with application path '%s'", resourcedir.c_str()); PRINTDB("Looking up resource folder with application path '%s'", resourcedir.c_str());
#ifndef WIN32
#ifdef __APPLE__ #ifdef __APPLE__
const char *searchpath[] = { const char *searchpath[] = {
"../Resources", // Resources can be bundled on Mac. "../Resources", // Resources can be bundled on Mac.
@ -34,7 +33,15 @@ static std::string lookupResourcesPath()
NULL NULL
}; };
#else #else
const char *searchpath[] = { #ifdef WIN32
const char *searchpath[] = {
".", // Release location
RESOURCE_FOLDER("../share/openscad"), // MSYS2 location
"..", // Dev location
NULL
};
#else
const char *searchpath[] = {
RESOURCE_FOLDER("../share/openscad"), RESOURCE_FOLDER("../share/openscad"),
RESOURCE_FOLDER("../../share/openscad"), RESOURCE_FOLDER("../../share/openscad"),
".", ".",
@ -43,6 +50,7 @@ static std::string lookupResourcesPath()
NULL NULL
}; };
#endif #endif
#endif
fs::path tmpdir; fs::path tmpdir;
for (int a = 0;searchpath[a] != NULL;a++) { for (int a = 0;searchpath[a] != NULL;a++) {
@ -57,7 +65,6 @@ static std::string lookupResourcesPath()
break; break;
} }
} }
#endif // !WIN32
// resourcedir defaults to applicationPath // resourcedir defaults to applicationPath
std::string result = boosty::stringy(boosty::canonical(resourcedir)); std::string result = boosty::stringy(boosty::canonical(resourcedir));