|
|
@@ -14,14 +14,17 @@ int32_t InfraredApp::run(void* args) {
|
|
|
if(args) {
|
|
|
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('.'));
|
|
|
- path.erase(path.find_last_of('/'));
|
|
|
- bool result = remote_manager.load(path, remote_name);
|
|
|
- if(result) {
|
|
|
- current_scene = InfraredApp::Scene::Remote;
|
|
|
- } else {
|
|
|
- printf("Failed to load remote \'%s\'\r\n", remote_name.c_str());
|
|
|
- return -1;
|
|
|
+ auto last_dot = remote_name.find_last_of('.');
|
|
|
+ if(last_dot != std::string::npos) {
|
|
|
+ remote_name.erase(last_dot);
|
|
|
+ path.erase(path.find_last_of('/'));
|
|
|
+ bool result = remote_manager.load(path, remote_name);
|
|
|
+ if(result) {
|
|
|
+ current_scene = InfraredApp::Scene::Remote;
|
|
|
+ } else {
|
|
|
+ printf("Failed to load remote \'%s\'\r\n", remote_name.c_str());
|
|
|
+ return -1;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|