From 34cb7c96de1075f7e00f8bf87b3211177bc1da46 Mon Sep 17 00:00:00 2001 From: itsmattkc Date: Thu, 29 Oct 2020 02:20:59 +1100 Subject: [PATCH] further enclosed C locale setting --- app/render/colormanager.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/app/render/colormanager.cpp b/app/render/colormanager.cpp index 3bf4e0164..a559b06f4 100644 --- a/app/render/colormanager.cpp +++ b/app/render/colormanager.cpp @@ -69,15 +69,10 @@ OCIO::ConstConfigRcPtr ColorManager::GetDefaultConfig() void ColorManager::SetUpDefaultConfig() { - // Extract OCIO config - kind of hacky, but it'll work - // Must do this before setting C locale - QString dir = QDir(QStandardPaths::writableLocation(QStandardPaths::CacheLocation)).filePath(QStringLiteral("ocioconf")); - - OCIO_SET_C_LOCALE_FOR_SCOPE; - if (!qgetenv("OCIO").isEmpty()) { // Attempt to set config from "OCIO" environment variable try { + OCIO_SET_C_LOCALE_FOR_SCOPE; default_config_ = OCIO::Config::CreateFromEnv(); return; @@ -86,13 +81,19 @@ void ColorManager::SetUpDefaultConfig() } } + // Extract OCIO config - kind of hacky, but it'll work + QString dir = QDir(QStandardPaths::writableLocation(QStandardPaths::CacheLocation)).filePath(QStringLiteral("ocioconf")); + FileFunctions::CopyDirectory(QStringLiteral(":/ocioconf"), dir, true); qDebug() << "Extracting default OCIO config to" << dir; - default_config_ = CreateConfigFromFile(QDir(dir).filePath(QStringLiteral("config.ocio"))); + { + OCIO_SET_C_LOCALE_FOR_SCOPE; + default_config_ = CreateConfigFromFile(QDir(dir).filePath(QStringLiteral("config.ocio"))); + } } void ColorManager::SetConfig(const QString &filename)