File manager handles clicks on folders and text files
@@ -384,7 +384,11 @@ static void _launch_amc_service_if_necessary(const char* service_name) {
}
static void _file_view_left_click(file_view_t* view, Point mouse_point) {
- assert(view->fs_node->base.type == FS_NODE_TYPE_INITRD, "Can only launch initrd programs");
+ // Don't try to open virtual fs nodes
+ if (view->fs_node->base.type != FS_NODE_TYPE_INITRD) {
+ printf("Ignoring click on virtual fs node: %s\n", view->fs_node->base.name);
+ return;
+ }
// For image files, ask the image viewer to open them
char* file_name = view->fs_node->initrd.name;
@@ -397,6 +401,9 @@ static void _file_view_left_click(file_view_t* view, Point mouse_point) {
snprintf(&req.path, sizeof(req.path), "%s", file_name);
amc_message_construct_and_send(IMAGE_VIEWER_SERVICE_NAME, &req, sizeof(image_viewer_load_image_request_t));
}
+ else if (str_ends_with(file_name, ".txt")) {
+ printf("Ignoring click on text file until text viewer is available: %s\n", file_name);
+ }
else {
_launch_program_by_node(view->fs_node);
}
