wxTigApp::GameData::GameData(Repo &rep) : config(rep.getPath("wxtiggit.conf")), news(&rep), repo(rep), updater(rep) { latest = new GameList(rep.baseList(), NULL); freeware = new GameList(rep.baseList(), &freePick); demos = new GameList(rep.baseList(), &demoPick); installed = new GameList(rep.baseList(), &instPick); }
// Try to look at a SQL statement and figure out which repoId it's targeting. static int debugComputeRepoIdFromSQL(Repo& repo, const std::string& stmt) { for (int i = 0; i < RepoIdCount; ++i) { auto name = repo.dbName(i); if (stmt.find(folly::format(" {}.", name).str()) != std::string::npos) { return i; } } return 0; }
static void reportDbCorruption(Repo& repo, int repoId, const std::string& where) { std::string report = folly::sformat("{} returned SQLITE_CORRUPT.\n", where); auto repoPath = sqlite3_db_filename(repo.dbc(), repo.dbName(repoId)); if (repoPath) { report += folly::sformat("Path: '{}'\n", repoPath); struct stat repoStat; if (stat(repoPath, &repoStat) == 0) { time_t now = time(nullptr); report += folly::sformat("{} bytes, c_age: {}, m_age: {}\n", repoStat.st_size, now - repoStat.st_ctime, now - repoStat.st_mtime); } else { report += "stat() failed\n"; } } else { report += "sqlite3_db_filename() returned nullptr\n"; } // Use raw SQLite here because we just want to hit the raw DB itself. sqlite3_exec(repo.dbc(), folly::sformat( "PRAGMA {}.integrity_check(4);", repo.dbName(repoId)).c_str(), [](void* _report, int columns, char** text, char** names) { std::string& report = *reinterpret_cast<std::string*>(_report); for (int column = 0; column < columns; ++column) { report += folly::sformat("Integrity Check ({}): {}\n", column, text[column]); } return 0; }, &report, nullptr); Logger::Error(report); }
wxTigApp::GameData::GameData(Repo &rep) : config(rep.getPath("wxtiggit.conf")), news(&rep), repo(rep), libs(rep.getPath("wxtiggit_libs.conf")), updater(rep) { repo.getSpread().getJobManager()->setLogger(rep.getPath("threads.log")); latest = new GameList(rep.baseList(), NULL); freeware = new GameList(rep.baseList(), &freePick); demos = new GameList(rep.baseList(), &demoPick); installed = new GameList(rep.baseList(), &instPick); }
int main(int argc, char *argv[]) { srand ( time(NULL) ); YARP_REGISTER_DEVICES(icubmod) Property options; options.fromCommand(argc, argv); if(!options.check("dist")){ printf("use: robotCartesian --robot [robot] --part [part] --dist [distance] --out [filename]\n"); printf("0.008 -> 8\n"); printf("0.010 -> 10\n"); printf("0.012 -> 12\n"); printf("0.014 -> 14\n"); printf("0.016 -> 16\n"); printf("0.018 -> 18\n"); return -1; } // double startd = START_DIST; Value distvalue = options.check("dist",0,"set value"); double startd = distvalue.asDouble(); printf("using starting distance: %f.\n",startd); Repo myRepo; if(!myRepo.init(options)) { printf("leave\n"); return -1; } myRepo.cross3D(startd); printf("\nDID cross %f.\n\n",startd); // 0.01x myRepo.box3D(startd); printf("\nDID box %f.\n\n",startd); startd+=0.010; myRepo.cross3D(startd); printf("\nDID cross %f.\n\n",startd); // 0.02x myRepo.box3D(startd); printf("\nDID box %f.\n\n",startd); startd+=0.010; myRepo.cross3D(startd); printf("\nDID cross %f.\n\n",startd); // 0.03x myRepo.box3D(startd); printf("\nDID box %f.\n\n",startd); startd+=0.010; myRepo.cross3D(startd); printf("\nDID cross %f.\n\n",startd); // 0.04x myRepo.box3D(startd); printf("\nDID box %f.\n\n",startd); myRepo.close(); return 0; }
bool Ref::exists(const QString &name, const Repo &repo) { return QFile::exists(QDir(repo.gitDir()).filePath(name)); }