diff --git a/src/Config.cpp b/src/Config.cpp index 5c768c07c..901d93ccb 100644 --- a/src/Config.cpp +++ b/src/Config.cpp @@ -202,6 +202,16 @@ class ConfigInternal { } } + const char* envPath = std::getenv("OPENCC_SHARED_DIR"); + if (envPath != nullptr) { + std::string path(envPath); + path += '/' + fileName; + ifs.open(UTF8Util::GetPlatformString(path).c_str()); + if (ifs.is_open()) { + return path; + } + } + throw FileNotFound(fileName); } };