Skip to content

Commit 286d606

Browse files
author
lindeer
committed
find config from env
1 parent 46ebc38 commit 286d606

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/Config.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,16 @@ class ConfigInternal {
202202
}
203203
}
204204

205+
const char* envPath = std::getenv("OPENCC_SHARED_DIR");
206+
if (envPath != nullptr) {
207+
std::string path(envPath);
208+
path += '/' + fileName;
209+
ifs.open(UTF8Util::GetPlatformString(path).c_str());
210+
if (ifs.is_open()) {
211+
return path;
212+
}
213+
}
214+
205215
throw FileNotFound(fileName);
206216
}
207217
};

0 commit comments

Comments
 (0)