mirror of
https://github.com/eried/portapack-mayhem.git
synced 2024-10-01 01:26:06 -04:00
Continued folder names consolidation & GPS default folder (#2042)
* Continued folder names consolidation * Clang
This commit is contained in:
parent
d5c8525afc
commit
264fa9a28e
@ -765,7 +765,7 @@ void BLERxView::on_filter_change(std::string value) {
|
||||
}
|
||||
|
||||
void BLERxView::on_file_changed(const std::filesystem::path& new_file_path) {
|
||||
file_path = fs::path(u"/") + new_file_path;
|
||||
file_path = new_file_path;
|
||||
found_count = 0;
|
||||
total_count = 0;
|
||||
searchList.clear();
|
||||
|
@ -449,7 +449,7 @@ BLETxView::BLETxView(
|
||||
}
|
||||
|
||||
void BLETxView::on_file_changed(const fs::path& new_file_path) {
|
||||
file_path = fs::path(u"/") + new_file_path;
|
||||
file_path = new_file_path;
|
||||
num_packets = 0;
|
||||
|
||||
{ // Get the size of the data file.
|
||||
|
@ -44,7 +44,7 @@ void ReplayAppView::set_ready() {
|
||||
}
|
||||
|
||||
void ReplayAppView::on_file_changed(const fs::path& new_file_path) {
|
||||
file_path = fs::path(u"/") + new_file_path;
|
||||
file_path = new_file_path;
|
||||
File::Size file_size{};
|
||||
|
||||
{ // Get the size of the data file.
|
||||
|
@ -1460,7 +1460,7 @@ void ReconView::handle_repeat_thread_done(const uint32_t return_code) {
|
||||
stop_repeat(true);
|
||||
} else if (return_code == ReplayThread::READ_ERROR) {
|
||||
stop_repeat(false);
|
||||
repeat_file_error(u"/" + repeat_rec_path + u"/" + repeat_rec_file, "Can't open file to send.");
|
||||
repeat_file_error(rawfile, "Can't open file to send.");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -28,6 +28,7 @@
|
||||
#include "io_file.hpp"
|
||||
#include "metadata_file.hpp"
|
||||
#include "utility.hpp"
|
||||
#include "file_path.hpp"
|
||||
|
||||
#include "baseband_api.hpp"
|
||||
#include "portapack.hpp"
|
||||
@ -43,7 +44,7 @@ void GpsSimAppView::set_ready() {
|
||||
}
|
||||
|
||||
void GpsSimAppView::on_file_changed(const fs::path& new_file_path) {
|
||||
file_path = fs::path(u"/") + new_file_path;
|
||||
file_path = new_file_path;
|
||||
File::Size file_size{};
|
||||
|
||||
{ // Get the size of the data file.
|
||||
@ -185,6 +186,8 @@ GpsSimAppView::GpsSimAppView(
|
||||
|
||||
button_open.on_select = [this, &nav](Button&) {
|
||||
auto open_view = nav.push<FileLoadView>(".C8");
|
||||
ensure_directory(gps_dir);
|
||||
open_view->push_dir(gps_dir);
|
||||
open_view->on_changed = [this](std::filesystem::path new_file_path) {
|
||||
on_file_changed(new_file_path);
|
||||
};
|
||||
|
@ -24,6 +24,7 @@
|
||||
|
||||
const std::filesystem::path adsb_dir = u"ADSB";
|
||||
const std::filesystem::path ais_dir = u"AIS";
|
||||
const std::filesystem::path apps_dir = u"APPS";
|
||||
const std::filesystem::path aprs_dir = u"APRS";
|
||||
const std::filesystem::path audio_dir = u"AUDIO";
|
||||
const std::filesystem::path blerx_dir = u"BLERX";
|
||||
@ -32,11 +33,13 @@ const std::filesystem::path captures_dir = u"CAPTURES";
|
||||
const std::filesystem::path debug_dir = u"DEBUG";
|
||||
const std::filesystem::path firmware_dir = u"FIRMWARE";
|
||||
const std::filesystem::path freqman_dir = u"FREQMAN";
|
||||
const std::filesystem::path gps_dir = u"GPS";
|
||||
const std::filesystem::path logs_dir = u"LOGS";
|
||||
const std::filesystem::path looking_glass_dir = u"LOOKINGGLASS";
|
||||
const std::filesystem::path playlist_dir = u"PLAYLIST";
|
||||
const std::filesystem::path remotes_dir = u"REMOTES";
|
||||
const std::filesystem::path repeat_rec_path = u"CAPTURES";
|
||||
const std::filesystem::path samples_dir = u"SAMPLES";
|
||||
const std::filesystem::path screenshots_dir = u"SCREENSHOTS";
|
||||
const std::filesystem::path settings_dir = u"SETTINGS";
|
||||
const std::filesystem::path spectrum_dir = u"SPECTRUM";
|
||||
|
@ -26,6 +26,7 @@
|
||||
|
||||
extern const std::filesystem::path adsb_dir;
|
||||
extern const std::filesystem::path ais_dir;
|
||||
extern const std::filesystem::path apps_dir;
|
||||
extern const std::filesystem::path aprs_dir;
|
||||
extern const std::filesystem::path audio_dir;
|
||||
extern const std::filesystem::path blerx_dir;
|
||||
@ -34,11 +35,13 @@ extern const std::filesystem::path captures_dir;
|
||||
extern const std::filesystem::path debug_dir;
|
||||
extern const std::filesystem::path firmware_dir;
|
||||
extern const std::filesystem::path freqman_dir;
|
||||
extern const std::filesystem::path gps_dir;
|
||||
extern const std::filesystem::path logs_dir;
|
||||
extern const std::filesystem::path looking_glass_dir;
|
||||
extern const std::filesystem::path playlist_dir;
|
||||
extern const std::filesystem::path remotes_dir;
|
||||
extern const std::filesystem::path repeat_rec_path;
|
||||
extern const std::filesystem::path samples_dir;
|
||||
extern const std::filesystem::path screenshots_dir;
|
||||
extern const std::filesystem::path settings_dir;
|
||||
extern const std::filesystem::path spectrum_dir;
|
||||
|
@ -1,6 +1,7 @@
|
||||
#include "ui_external_items_menu_loader.hpp"
|
||||
|
||||
#include "sd_card.hpp"
|
||||
#include "file_path.hpp"
|
||||
|
||||
namespace ui {
|
||||
|
||||
@ -11,8 +12,8 @@ namespace ui {
|
||||
if (!callback) return;
|
||||
if (sd_card::status() != sd_card::Status::Mounted)
|
||||
return;
|
||||
for (const auto& entry : std::filesystem::directory_iterator(u"APPS", u"*.ppma")) {
|
||||
auto filePath = u"/APPS/" + entry.path();
|
||||
for (const auto& entry : std::filesystem::directory_iterator(apps_dir, u"*.ppma")) {
|
||||
auto filePath = apps_dir / entry.path();
|
||||
File app;
|
||||
|
||||
auto openError = app.open(filePath);
|
||||
@ -52,8 +53,8 @@ namespace ui {
|
||||
if (sd_card::status() != sd_card::Status::Mounted)
|
||||
return external_apps;
|
||||
|
||||
for (const auto& entry : std::filesystem::directory_iterator(u"APPS", u"*.ppma")) {
|
||||
auto filePath = u"/APPS/" + entry.path();
|
||||
for (const auto& entry : std::filesystem::directory_iterator(apps_dir, u"*.ppma")) {
|
||||
auto filePath = apps_dir / entry.path();
|
||||
File app;
|
||||
|
||||
auto openError = app.open(filePath);
|
||||
@ -86,7 +87,7 @@ namespace ui {
|
||||
|
||||
gridItem.on_select = [&nav, app_location, filePath]() {
|
||||
if (!run_external_app(nav, filePath)) {
|
||||
nav.display_modal("Error", "The .ppma file in your APPS\nfolder can't be read. Please\nupdate your SD Card content.");
|
||||
nav.display_modal("Error", "The .ppma file in your " + apps_dir.string() + "\nfolder can't be read. Please\nupdate your SD Card content.");
|
||||
}
|
||||
};
|
||||
} else {
|
||||
@ -95,7 +96,7 @@ namespace ui {
|
||||
gridItem.bitmap = &bitmap_sd_card_error;
|
||||
|
||||
gridItem.on_select = [&nav]() {
|
||||
nav.display_modal("Error", "The .ppma file in your APPS\nfolder is outdated. Please\nupdate your SD Card content.");
|
||||
nav.display_modal("Error", "The .ppma file in your " + apps_dir.string() + "\nfolder is outdated. Please\nupdate your SD Card content.");
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -719,6 +719,7 @@ static void add_apps(NavigationView& nav, BtnGridView& grid, app_location_t loc)
|
||||
};
|
||||
}
|
||||
|
||||
// clang-format off
|
||||
void addExternalItems(NavigationView& nav, app_location_t location, BtnGridView& grid) {
|
||||
auto externalItems = ExternalItemsMenuLoader::load_external_items(location, nav);
|
||||
if (externalItems.empty()) {
|
||||
@ -730,7 +731,7 @@ void addExternalItems(NavigationView& nav, app_location_t location, BtnGridView&
|
||||
"Notice",
|
||||
"External app directory empty;\n"
|
||||
"see Mayhem wiki and copy apps\n"
|
||||
"to APPS folder of SD card.");
|
||||
"to " + apps_dir.string() + " folder of SD card.");
|
||||
}});
|
||||
} else {
|
||||
for (auto const& gridItem : externalItems) {
|
||||
@ -738,6 +739,7 @@ void addExternalItems(NavigationView& nav, app_location_t location, BtnGridView&
|
||||
}
|
||||
}
|
||||
}
|
||||
// clang-format on
|
||||
|
||||
/* ReceiversMenuView *****************************************************/
|
||||
|
||||
|
@ -665,7 +665,7 @@ static void cmd_appstart(BaseSequentialStream* chp, int argc, char* argv[]) {
|
||||
return;
|
||||
}
|
||||
// since ext app loader changed, we can just pass the string to it, and it"ll return if started or not.
|
||||
std::string appwithpath = "/APPS/";
|
||||
std::string appwithpath = "/" + apps_dir.string() + "/";
|
||||
appwithpath += argv[0];
|
||||
appwithpath += ".ppma";
|
||||
bool ret = ui::ExternalItemsMenuLoader::run_external_app(*nav, path_from_string8((char*)appwithpath.c_str()));
|
||||
|
Loading…
Reference in New Issue
Block a user