mirror of
https://github.com/eried/portapack-mayhem.git
synced 2025-07-27 00:35:59 -04:00
Auto start again (#2333)
* Extend autostart a bit * @zxkmm 's sizeof fix
This commit is contained in:
parent
5bb23b636e
commit
d6a9c74665
4 changed files with 56 additions and 43 deletions
|
@ -724,42 +724,40 @@ void NavigationView::handle_autostart() {
|
|||
"nav"sv,
|
||||
{{"autostart_app"sv, &autostart_app}}};
|
||||
if (!autostart_app.empty()) {
|
||||
bool app_started = false;
|
||||
bool started = false;
|
||||
// inner app
|
||||
if (StartAppByName(autostart_app.c_str())) {
|
||||
app_started = true;
|
||||
return;
|
||||
started = true;
|
||||
}
|
||||
|
||||
// lambda
|
||||
auto execute_app = [=](const std::string& extension) { // TODO: capture ref aka [&] would also lagging th GUI, no idea why
|
||||
std::string appwithpath = "/" + apps_dir.string() + "/" + autostart_app + extension;
|
||||
if (!started) {
|
||||
// ppma
|
||||
|
||||
std::string appwithpath = "/" + apps_dir.string() + "/" + autostart_app + ".ppma";
|
||||
std::wstring_convert<std::codecvt_utf8_utf16<char16_t>, char16_t> conv;
|
||||
std::filesystem::path pth = conv.from_bytes(appwithpath.c_str());
|
||||
if (ui::ExternalItemsMenuLoader::run_external_app(*this, pth)) {
|
||||
return true;
|
||||
started = true;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
// outside app
|
||||
if (!app_started) {
|
||||
app_started = execute_app(".ppma");
|
||||
if (!started) {
|
||||
// ppmp / standalone
|
||||
appwithpath = "/" + apps_dir.string() + "/" + autostart_app + ".ppmp";
|
||||
pth = conv.from_bytes(appwithpath.c_str());
|
||||
if (ui::ExternalItemsMenuLoader::run_standalone_app(*this, pth)) {
|
||||
started = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// standalone app
|
||||
if (!app_started) {
|
||||
app_started = execute_app(".ppmp");
|
||||
}
|
||||
|
||||
if (!app_started) {
|
||||
if (!started) {
|
||||
display_modal(
|
||||
"Notice", "Autostart failed:\n" +
|
||||
autostart_app +
|
||||
"\nupdate sdcard content\n" +
|
||||
"and check if .ppma exists");
|
||||
}
|
||||
}
|
||||
} // autostart end
|
||||
return;
|
||||
}
|
||||
|
||||
/* Helpers **************************************************************/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue