use find_executable() to find scripts

Origin commit data
------------------
Commit: 05a3384959
Author: vanhofen <vanhofen@gmx.de>
Date: 2020-12-06 (Sun, 06 Dec 2020)

Origin message was:
------------------
- use find_executable() to find scripts
This commit is contained in:
vanhofen
2020-12-06 16:38:07 +01:00
parent 4840133e3f
commit 5e3d587ff9
2 changed files with 11 additions and 10 deletions

View File

@@ -141,10 +141,10 @@ int CSettingsManager::exec(CMenuTarget* parent, const std::string &actionKey)
CHintBox * hintBox = new CHintBox(LOCALE_MESSAGEBOX_INFO, g_Locale->getText(LOCALE_SETTINGS_BACKUP));
hintBox->paint();
const char backup_sh[] = TARGET_PREFIX "/bin/backup.sh";
std::string backup_sh = find_executable("backup.sh");
std::string fname = "settings_" + getBackupSuffix(); // file ending is set by backup script;
dprintf(DEBUG_NORMAL, "[CSettingsManager]\t[%s - %d] executing [%s %s]\n", __func__, __LINE__, backup_sh, g_settings.backup_dir.c_str());
my_system(3, backup_sh, g_settings.backup_dir.c_str(), fname.c_str());
dprintf(DEBUG_NORMAL, "[CSettingsManager]\t[%s - %d] executing [%s %s]\n", __func__, __LINE__, backup_sh.c_str(), g_settings.backup_dir.c_str());
my_system(3, backup_sh.c_str(), g_settings.backup_dir.c_str(), fname.c_str());
hintBox->hide();
delete hintBox;
@@ -165,10 +165,10 @@ int CSettingsManager::exec(CMenuTarget* parent, const std::string &actionKey)
int result = ShowMsg(LOCALE_SETTINGS_RESTORE, g_Locale->getText(LOCALE_SETTINGS_RESTORE_WARN), CMsgBox::mbrNo, CMsgBox::mbYes | CMsgBox::mbNo);
if(result == CMsgBox::mbrYes)
{
const char restore_sh[] = TARGET_PREFIX "/bin/restore.sh";
std::string restore_sh = find_executable("restore.sh");
std::string restore_file = fileBrowser.getSelectedFile()->Name;
dprintf(DEBUG_NORMAL, "[CSettingsManager]\t[%s - %d] executing [%s %s]\n", __func__, __LINE__, restore_sh, restore_file.c_str());
my_system(2, restore_sh, restore_file.c_str());
dprintf(DEBUG_NORMAL, "[CSettingsManager]\t[%s - %d] executing [%s %s]\n", __func__, __LINE__, restore_sh.c_str(), restore_file.c_str());
my_system(2, restore_sh.c_str(), restore_file.c_str());
}
}
return res;