Fix resource loading from source tree

This commit is contained in:
Brad Davis 2018-01-25 11:07:39 -08:00
parent e3f859329d
commit 3915a2d4ba

View file

@ -29,7 +29,6 @@
#include <mach-o/dyld.h>
#endif
#include "shared/GlobalAppProperties.h"
#include "SharedUtil.h"
@ -41,8 +40,15 @@ QString TEMP_DIR_FORMAT { "%1-%2-%3" };
#if defined(Q_OS_OSX)
static bool USE_SOURCE_TREE_RESOURCES = true;
#else
static const QString USE_SOURCE_TREE_RESOURCES_FLAG("HIFI_USE_SOURCE_TREE_RESOURCES");
static bool USE_SOURCE_TREE_RESOURCES = QProcessEnvironment::systemEnvironment().contains(USE_SOURCE_TREE_RESOURCES_FLAG);
static bool USE_SOURCE_TREE_RESOURCES() {
static bool result = false;
static std::once_flag once;
std::call_once(once, [&] {
const QString USE_SOURCE_TREE_RESOURCES_FLAG("HIFI_USE_SOURCE_TREE_RESOURCES");
result = QProcessEnvironment::systemEnvironment().contains(USE_SOURCE_TREE_RESOURCES_FLAG);
});
return result;
}
#endif
#endif
@ -77,7 +83,7 @@ const QString& PathUtils::resourcesPath() {
#endif
#if !defined(Q_OS_ANDROID) && defined(DEV_BUILD)
if (USE_SOURCE_TREE_RESOURCES) {
if (USE_SOURCE_TREE_RESOURCES()) {
// For dev builds, optionally load content from the Git source tree
staticResourcePath = projectRootPath() + "/interface/resources/";
}
@ -100,7 +106,7 @@ const QString& PathUtils::resourcesUrl() {
#endif
#if !defined(Q_OS_ANDROID) && defined(DEV_BUILD)
if (USE_SOURCE_TREE_RESOURCES) {
if (USE_SOURCE_TREE_RESOURCES()) {
// For dev builds, optionally load content from the Git source tree
staticResourcePath = QUrl::fromLocalFile(projectRootPath() + "/interface/resources/").toString();
}