diff --git a/joomer-ftxui-file-browser.cpp b/joomer-ftxui-file-browser.cpp index 8e8b302..6da5076 100644 --- a/joomer-ftxui-file-browser.cpp +++ b/joomer-ftxui-file-browser.cpp @@ -152,7 +152,10 @@ int main(int argc, char* argv[]) { CleanTrailingSlash(current_path); directory_path = current_path; // Update global variable if (std::filesystem::is_regular_file(new_path)) + { + final_selected_index = selected; // Store the final selection index screen.Exit(); // Exit the application + } // Call the function to switch and reload ReloadDirectory(screen, new_path, entries,clean_names); selected = 0; // Reset selection to the first item @@ -211,6 +214,9 @@ int main(int argc, char* argv[]) { std::cout<< "directory path: " << directory_path << std::endl; if (final_selected_index >= 0 && final_selected_index < entries.size()) { std::cout << "Selected Entry: " << entries[final_selected_index] << std::endl; + std::cout << "Full Path: " << std::filesystem::path(directory_path) / clean_names[final_selected_index] << std::endl; + std::cout << "current_path: " << current_path << std::endl; + std::cout << "file size: " << std::filesystem::file_size(std::filesystem::path(current_path)) << " bytes" << std::endl; } else { std::cout << "Selection cancelled or no valid entry selected." << std::endl; }