show file size when file is selected and terminate
This commit is contained in:
parent
8a77a040c0
commit
b68f69f1e3
@ -152,7 +152,10 @@ int main(int argc, char* argv[]) {
|
|||||||
CleanTrailingSlash(current_path);
|
CleanTrailingSlash(current_path);
|
||||||
directory_path = current_path; // Update global variable
|
directory_path = current_path; // Update global variable
|
||||||
if (std::filesystem::is_regular_file(new_path))
|
if (std::filesystem::is_regular_file(new_path))
|
||||||
|
{
|
||||||
|
final_selected_index = selected; // Store the final selection index
|
||||||
screen.Exit(); // Exit the application
|
screen.Exit(); // Exit the application
|
||||||
|
}
|
||||||
// Call the function to switch and reload
|
// Call the function to switch and reload
|
||||||
ReloadDirectory(screen, new_path, entries,clean_names);
|
ReloadDirectory(screen, new_path, entries,clean_names);
|
||||||
selected = 0; // Reset selection to the first item
|
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;
|
std::cout<< "directory path: " << directory_path << std::endl;
|
||||||
if (final_selected_index >= 0 && final_selected_index < entries.size()) {
|
if (final_selected_index >= 0 && final_selected_index < entries.size()) {
|
||||||
std::cout << "Selected Entry: " << entries[final_selected_index] << std::endl;
|
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 {
|
} else {
|
||||||
std::cout << "Selection cancelled or no valid entry selected." << std::endl;
|
std::cout << "Selection cancelled or no valid entry selected." << std::endl;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user