Merge pull request #1531 from shun-iwasawa/env_template

Template Env File
This commit is contained in:
Jeremy Bullock 2017-10-24 23:38:03 -06:00 committed by GitHub
commit 22f3c9edbd

View file

@ -171,6 +171,9 @@ public:
}
TFilePath getEnvFile() { return m_envFile; }
TFilePath getTemplateEnvFile() {
return m_envFile.getParentDir() + TFilePath("template.env");
}
void setApplicationFullName(std::string applicationFullName) {
m_applicationFullName = applicationFullName;
@ -326,8 +329,11 @@ void VariableSet::load() {
#endif
TFilePath fp = EnvGlobals::instance()->getEnvFile();
if (fp == TFilePath()) return;
// if the personal env is not found, then try to find the template
if (!TFileStatus(fp).doesExist())
fp = EnvGlobals::instance()->getTemplateEnvFile();
Tifstream is(fp);
if (!is) return;
if (!is.isOpen()) return;
char buffer[1024];
while (is.getline(buffer, sizeof(buffer))) {
char *s = buffer;