@@ -47,6 +47,7 @@ void Shell::Loop() {
4747void Shell::InitializeFolderSystem () {
4848 // Clear and initialize folders
4949 folders.clear ();
50+ python_app_infos.clear ();
5051 all_applications.clear ();
5152
5253 // Load folder colors
@@ -61,8 +62,7 @@ void Shell::InitializeFolderSystem() {
6162
6263 // First, add all native apps to all_applications
6364 for (const auto & [app_id, app_info] : applications) {
64- ApplicationEntry* entry = new ApplicationEntry (app_info);
65- all_applications[app_id] = entry;
65+ all_applications.emplace (app_id, ApplicationEntry (app_info));
6666 }
6767
6868 // Then discover and add Python applications
@@ -103,9 +103,12 @@ void Shell::InitializeFolderSystem() {
103103 folders[folder_id].app_ids .push_back (app_id);
104104 missing_apps_found = true ;
105105
106+ Application_Info* info = (app_entry.type == ApplicationType::Native) ?
107+ app_entry.native .info :
108+ &(app_entry.python .info ->info );
106109 MLOGD (" Shell" , " Added app %s-%s to folder %d" ,
107- app_entry-> info ->author .c_str (),
108- app_entry-> info ->name .c_str (),
110+ info->author .c_str (),
111+ info->name .c_str (),
109112 folder_id);
110113 }
111114 }
@@ -308,9 +311,12 @@ void Shell::CleanupInvalidApps() {
308311 }
309312}
310313
311- uint8_t Shell::GetAppFolder (uint32_t app_id, ApplicationEntry* app_entry) {
314+ uint8_t Shell::GetAppFolder (uint32_t app_id, const ApplicationEntry& app_entry) {
312315 // Check if app is invisible first
313- if (!app_entry->info ->visibility ) {
316+ Application_Info* info = (app_entry.type == ApplicationType::Native) ?
317+ app_entry.native .info :
318+ &(app_entry.python .info ->info );
319+ if (!info->visibility ) {
314320 return FOLDER_INVISIBLE;
315321 }
316322
@@ -329,11 +335,11 @@ uint8_t Shell::GetAppFolder(uint32_t app_id, ApplicationEntry* app_entry) {
329335void Shell::DiscoverPythonApps () {
330336 MLOGI (" Shell" , " Starting Python application discovery" );
331337
332- // Get discovered Python apps
333- vector< PythonAppDiscovery::DiscoveredPythonApp> python_apps = PythonAppDiscovery:: ScanPythonApplications ();
338+ // Scan Python apps directly into our storage
339+ PythonAppDiscovery::ScanPythonApplications (python_app_infos );
334340
335341 // Add them to shell's application map
336- for (const auto & py_app : python_apps ) {
342+ for (auto & py_app : python_app_infos ) {
337343 uint32_t app_id = StringHash (py_app.info .author + " -" + py_app.info .name );
338344
339345 // Check for duplicates
@@ -343,15 +349,14 @@ void Shell::DiscoverPythonApps() {
343349 continue ;
344350 }
345351
346- // Create ApplicationEntry for Python app
347- ApplicationEntry* entry = new ApplicationEntry (py_app.info , py_app.python_file_path );
348- all_applications[app_id] = entry;
352+ // Create ApplicationEntry pointing to the stored PythonAppInfo
353+ all_applications.emplace (app_id, ApplicationEntry (&py_app));
349354
350355 MLOGD (" Shell" , " Registered Python app: %s-%s (ID: %X)" ,
351356 py_app.info .author .c_str (), py_app.info .name .c_str (), app_id);
352357 }
353358
354- MLOGI (" Shell" , " Python application discovery completed: %d apps added" , python_apps .size ());
359+ MLOGI (" Shell" , " Python application discovery completed: %d apps added" , python_app_infos .size ());
355360}
356361
357362void Shell::ApplicationLauncher () {
0 commit comments