cleaned up commands in launcher.cpp.... We should launch the binary and save the son's pid in retrofe (like in gmenu2x)

This commit is contained in:
Vincent-FK 2021-06-20 00:53:32 +02:00
parent 751cf64dd3
commit ee5489b18e

View File

@ -120,15 +120,11 @@ bool Launcher::run(std::string collection, Item *collectionItem)
selectedItemsDirectory, selectedItemsDirectory,
collection); collection);
/* Create shell cmd */ /* Initialize keymap rom command */
std::string cmd = SHELL_CMD_MAPPING_ROM; std::string cmd = SHELL_CMD_MAPPING_ROM;
cmd += " '" + selectedItemsPath + "'"; cmd += " '" + selectedItemsPath + "'";
/* Log shell cmd */
Logger::write(Logger::ZONE_INFO, "Launcher", "Applying keymap rom: \"" + selectedItemsPath + "\""); Logger::write(Logger::ZONE_INFO, "Launcher", "Applying keymap rom: \"" + selectedItemsPath + "\"");
printf("Applying keymap rom cmd: \"%s\"\n", cmd.c_str()); printf("Applying keymap rom cmd: \"%s\"\n", cmd.c_str());
/* Launch shell cmd */
system(cmd.c_str()); system(cmd.c_str());
/* Restart audio amp */ /* Restart audio amp */
@ -144,14 +140,12 @@ bool Launcher::run(std::string collection, Item *collectionItem)
/* Stop audio amp */ /* Stop audio amp */
system(SHELL_CMD_AUDIO_AMP_OFF); system(SHELL_CMD_AUDIO_AMP_OFF);
/* Log shell cmd */ /* Restore default keymap */
Logger::write(Logger::ZONE_INFO, "Launcher", "Applying keymap default"); Logger::write(Logger::ZONE_INFO, "Launcher", "Applying keymap default");
printf("Applying keymap default cmd: \"%s\"\n", SHELL_CMD_MAPPING_DEFAULT); printf("Applying keymap default cmd: \"%s\"\n", SHELL_CMD_MAPPING_DEFAULT);
/* Restore default key mapping */
system(SHELL_CMD_MAPPING_DEFAULT); system(SHELL_CMD_MAPPING_DEFAULT);
/* Restore stored PID */ /* Restore retrofe PID */
char shellCmd[20]; char shellCmd[20];
sprintf(shellCmd, "%s %d", SHELL_CMD_PID_RECORD, getpid()); sprintf(shellCmd, "%s %d", SHELL_CMD_PID_RECORD, getpid());
Utils::executeRawPath((const char*)shellCmd); Utils::executeRawPath((const char*)shellCmd);
@ -230,7 +224,6 @@ bool Launcher::execute(std::string executable, std::string args, std::string cur
{ {
Logger::write(Logger::ZONE_ERROR, "Launcher", "Failed to run: " + executable); Logger::write(Logger::ZONE_ERROR, "Launcher", "Failed to run: " + executable);
} }
else else
{ {
#ifdef WIN32 #ifdef WIN32