[FL-2356] Infrared: Fix opening files outside app folder #1050

This commit is contained in:
Nikolay Minaylov
2022-03-23 21:51:40 +03:00
committed by GitHub
parent c4a0847c99
commit 46a894bc5c
4 changed files with 33 additions and 24 deletions

View File

@@ -12,10 +12,11 @@ int32_t InfraredApp::run(void* args) {
bool exit = false;
if(args) {
std::string full_name = static_cast<const char*>(args);
std::string remote_name(full_name, full_name.find_last_of('/') + 1, full_name.size());
std::string path = static_cast<const char*>(args);
std::string remote_name(path, path.find_last_of('/') + 1, path.size());
remote_name.erase(remote_name.find_last_of('.'));
bool result = remote_manager.load(remote_name);
path.erase(path.find_last_of('/'));
bool result = remote_manager.load(path, remote_name);
if(result) {
current_scene = InfraredApp::Scene::Remote;
} else {