bool Database::Open(const std::string& path) { assert(!path.empty()); this->path=path; typeConfig=std::make_shared<TypeConfig>(); if (!typeConfig->LoadFromDataFile(path)) { log.Error() << "Cannot load 'types.dat'!"; return false; } FileScanner scanner; try { scanner.Open(AppendFileToDir(path,"bounding.dat"), FileScanner::Normal, false); scanner.ReadBox(boundingBox); log.Debug() << "BoundingBox: " << boundingBox.GetDisplayText(); scanner.Close(); } catch (IOException& e) { log.Error() << e.GetDescription(); scanner.CloseFailsafe(); return false; } isOpen=true; return true; }
bool Database::Open(const std::string& path) { assert(!path.empty()); this->path=path; typeConfig=new TypeConfig(); if (!typeConfig->LoadFromDataFile(path)) { log.Error() << "Cannot load 'types.dat'!"; return false; } FileScanner scanner; std::string file=AppendFileToDir(path,"bounding.dat"); if (!scanner.Open(file,FileScanner::Normal,true)) { log.Error() << "Cannot open '" << scanner.GetFilename() << "'"; return false; } if (!scanner.ReadBox(boundingBox)) { log.Error() << "Error while reading '" << scanner.GetFilename() << "'"; } log.Debug() << "BoundingBox: " << boundingBox.GetDisplayText(); if (scanner.HasError() || !scanner.Close()) { log.Error() << "Cannot while reading/closing '" << scanner.GetFilename() << "'"; return false; } isOpen=true; return true; }