std::vector<Team> Team::getTeams(const std::string& filename) { std::string _filename = filename; if(filename == "") _filename = "teams.cfg"; std::vector<Team> teams; InMapFile stream(linuxToPlatformPath(_filename)); if(!stream.exists()) { Session::getInstance().log(CRITICAL, "Team: Cannot read teams from " + _filename); return teams; } readTeams(stream, teams); return teams; }
bool CommitColtableCmd::execute(Context &context, const std::vector<std::string> ¶ms) { // TODO // * select location (parameter?, gui?) #ifndef MACOSX std::string ctHashConfig = "Debug"; #else std::string ctHashConfig = "Release"; #endif std::string ctHash = getCtHash(ctHashConfig); File ctHashFile(ctHash, "r"); if(!ctHashFile.exists()) { bool compileStatus = context.execute("compile " + ctHashConfig + " ctHash"); if(!compileStatus) return false; } std::string location = "Default"; std::vector<std::string> coltables = Filesystem::getColtables(location); std::vector<std::string> files; // *.kdt and *.c64 std::string message = "Bushed color tables.\n\n"; std::string pathPrefix = linuxToPlatformPath(std::string(File::getBHDir()) + "/Config/Locations/" + location + "/"); for(size_t i = 0; i < coltables.size(); i++) { const std::string& coltable = coltables[i]; if(coltable != "coltableSim") { files.push_back(pathPrefix + coltable + ".c64"); files.push_back(pathPrefix + coltable + ".kdt"); QStringList args; args << fromString(pathPrefix + coltable + ".c64"); ProcessRunner r(fromString(ctHash), args); r.run(); std::string hash = toString(r.getOutput().split("\t")[0]); context.printLine("Found " + coltable + " (" + hash + ")"); } } VersionControlSystem* vcs = Session::getInstance().getVCS(); // TODO mutex vcs->publish(files, message); return true; }
std::vector<Robot> Robot::getRobots() { std::vector<Robot> robots; std::string robotsDir = "Robots"; Directory d; if(d.open(*File::getFullNames(robotsDir).begin() + "/*")) { std::string dir; bool isDir; while(d.read(dir, isDir)) { if(isDir) { ConfigMap cm; std::string s = linuxToPlatformPath(dir + "/robot.cfg"); int status = cm.read(s); if(status > 0) { Robot r; cm >> r; robots.push_back(r); } } }
std::string CommitColtableCmd::getCtHash(const std::string& ctHashConfig) { return linuxToPlatformPath(std::string(File::getBHDir()) + "/Build/ctHash/" + platformDirectory() + "/" + ctHashConfig + "/ctHash"); }