mirror of
https://github.com/portapack-mayhem/mayhem-firmware.git
synced 2024-12-04 23:45:26 +00:00
autostart fix 2 (#2331)
This commit is contained in:
parent
d5296c6ac3
commit
5bb23b636e
@ -725,20 +725,31 @@ void NavigationView::handle_autostart() {
|
|||||||
{{"autostart_app"sv, &autostart_app}}};
|
{{"autostart_app"sv, &autostart_app}}};
|
||||||
if (!autostart_app.empty()) {
|
if (!autostart_app.empty()) {
|
||||||
bool app_started = false;
|
bool app_started = false;
|
||||||
|
// inner app
|
||||||
// try innerapp
|
|
||||||
if (StartAppByName(autostart_app.c_str())) {
|
if (StartAppByName(autostart_app.c_str())) {
|
||||||
app_started = true;
|
app_started = true;
|
||||||
} else {
|
return;
|
||||||
// try outside app
|
}
|
||||||
auto external_items = ExternalItemsMenuLoader::load_external_items(app_location_t::HOME, *this);
|
|
||||||
for (const auto& item : external_items) {
|
// lambda
|
||||||
if (item.text == autostart_app) {
|
auto execute_app = [=](const std::string& extension) { // TODO: capture ref aka [&] would also lagging th GUI, no idea why
|
||||||
item.on_select();
|
std::string appwithpath = "/" + apps_dir.string() + "/" + autostart_app + extension;
|
||||||
app_started = true;
|
std::wstring_convert<std::codecvt_utf8_utf16<char16_t>, char16_t> conv;
|
||||||
break;
|
std::filesystem::path pth = conv.from_bytes(appwithpath.c_str());
|
||||||
}
|
if (ui::ExternalItemsMenuLoader::run_external_app(*this, pth)) {
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
|
||||||
|
// outside app
|
||||||
|
if (!app_started) {
|
||||||
|
app_started = execute_app(".ppma");
|
||||||
|
}
|
||||||
|
|
||||||
|
// standalone app
|
||||||
|
if (!app_started) {
|
||||||
|
app_started = execute_app(".ppmp");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!app_started) {
|
if (!app_started) {
|
||||||
|
Loading…
Reference in New Issue
Block a user