modified src/main.cpp +10 -0
| @@ -62,6 +62,16 @@ void initialize_database(sqlite3* database) { |
| 62 | 62 | printMessage("Database Initialized"); |
| 63 | 63 | } |
| 64 | 64 | |
| 65 | +void runGame(sqlite3* database, std::string gameName) { |
| 66 | + std::string pathToRun = ""; |
| 67 | + for (const auto& [name, path] : games) { |
| 68 | + if (name == gameName) { |
| 69 | + pathToRun = path; |
| 70 | + } |
| 71 | + } |
| 72 | + system(pathToRun.c_str()); |
| 73 | +} |
| 74 | + |
| 65 | 75 | void handleCommand(int argc, char const *argv[], sqlite3* database) { |
| 66 | 76 | std::string command{}; |
| 67 | 77 | switch (argc) { |
| @@ -62,6 +62,16 @@ void initialize_database(sqlite3* database) { |
| 62 | printMessage("Database Initialized"); | 62 | printMessage("Database Initialized"); |
| 63 | } | 63 | } |
| 64 | | 64 | |
| | 65 | +void runGame(sqlite3* database, std::string gameName) { |
| | 66 | + std::string pathToRun = ""; |
| | 67 | + for (const auto& [name, path] : games) { |
| | 68 | + if (name == gameName) { |
| | 69 | + pathToRun = path; |
| | 70 | + } |
| | 71 | + } |
| | 72 | + system(pathToRun.c_str()); |
| | 73 | +} |
| | 74 | + |
| 65 | void handleCommand(int argc, char const *argv[], sqlite3* database) { | 75 | void handleCommand(int argc, char const *argv[], sqlite3* database) { |
| 66 | std::string command{}; | 76 | std::string command{}; |
| 67 | switch (argc) { | 77 | switch (argc) { |