bool InstanceConfig :: load(path_t path, Templates* templates) { IniConfigFile config; if (_ELENA_::emptystr(path) || !config.load(path, feUTF8)) { return false; } if (templates != NULL) { // load template IdentifierString projectTemplate(config.getSetting(PROJECT_CATEGORY, PROJECT_TEMPLATE)); if (!_ELENA_::emptystr(projectTemplate)) { Path templatePath; Path::loadPath(templatePath, templates->get(projectTemplate)); load(templatePath, templates); } } _ELENA_::Path configPath; configPath.copySubPath(path); // init config init(configPath, config); return true; }
// === Main Program === int main(int argc, char* argv[]) { printf("ELENA command line ByteCode Viewer %d.%d.%d (C)2012-2013 by Alexei Rakov\n\n", ENGINE_MAJOR_VERSION, ENGINE_MINOR_VERSION, BUILD_VERSION); if (argc<2) { printf("ecv <module name> | ecv -p<module path>"); return 0; } // prepare library manager const char* configPath = "elc.cfg"; const char* rootPath = NULL; // get viewing module name IdentifierString moduleName(argv[1]); // load config attributes IniConfigFile config; if (config.load(Path(configPath), feUTF8)) { rootPath = config.getSetting(PROJECT_SECTION, ROOTPATH_OPTION, rootPath); } LibraryManager loader(Path(rootPath), NULL); LoadResult result = lrNotFound; _Module* module = NULL; // if direct path is provieded if (moduleName[0]=='-' && moduleName[1]=='p') { moduleName = moduleName + 2; Path path; path.copyPath(moduleName); FileName name(moduleName); loader.setPackage(name, path); module = loader.loadModule(name, result, false); } else module = loader.loadModule(moduleName, result, false); if (result != lrSuccessful) { printLoadError(result); return -1; } else wprintf(_T("%s module loaded\n"), (const wchar16_t*)moduleName); loadVerbs(_verbs); runSession(module); if (_writer) freeobj(_writer); return 0; }
bool ELENAMachine::Config :: load(path_t path, Templates* templates) { IniConfigFile config; _ELENA_::Path rootPath; rootPath.copySubPath(path); if (_ELENA_::emptystr(path) || !config.load(path, feUTF8)) { return false; } // load templates if (templates) { loadList(config, TEMPLATE_CATEGORY, rootPath, templates); } init(rootPath, config); return true; }