bool CConfig::load() { QFile file("data/config"); if (!file.open(QIODevice::ReadOnly)) return false; QString user = "******"; QString password = "******"; QDataStream cfgIn(&file); cfgIn >> user >> password >> m_save >> m_ips >> m_file >> m_interval >> m_limit; if (m_save) { m_user = user; m_password = password; } return true; }
TString getSrcDir() { TString rootsys("$ROOTSYS"); gSystem->ExpandPathName(rootsys); TString cfgLoc(rootsys + "/config/Makefile.config"); ifstream cfgIn(cfgLoc); if (!cfgIn) { return rootsys; } TString line; while (line.ReadLine(cfgIn)) { if (line.BeginsWith("ROOT_SRCDIR")) { Ssiz_t posRP = line.Index("realpath, "); if (posRP != -1) { line.Remove(0, posRP + 10); line.Remove(line.Length() - 1); } else { line.Remove(0, 19); } return line; } } return rootsys; }