show file size when file is selected and terminate

This commit is contained in:
Jason Ly 2025-12-27 19:22:01 -05:00
parent 8a77a040c0
commit b68f69f1e3

View File

@ -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;
}