From 4b740719ff38cdc438defc40e5f5ad4b77880604 Mon Sep 17 00:00:00 2001 From: Jason Ly Date: Thu, 18 Dec 2025 08:53:12 -0500 Subject: [PATCH] string() to make it work for both windows/linux --- joomer-ftxui-file-browser.cpp | 10 ++++------ joomer-ftxui-file-browser.vcxproj | 2 +- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/joomer-ftxui-file-browser.cpp b/joomer-ftxui-file-browser.cpp index c22d1cd..32f1c93 100644 --- a/joomer-ftxui-file-browser.cpp +++ b/joomer-ftxui-file-browser.cpp @@ -21,9 +21,8 @@ void ReloadDirectory(ftxui::ScreenInteractive& screen, const fs::path& new_path, // Check if the path is a valid directory if (!fs::exists(new_path) || !fs::is_directory(new_path)) { // Handle error case (optional: display a warning in the TUI) - cerr << "Error: Not a directory or path does not exist." << endl; - //test = "path not a directory: " + string(new_path.c_str()); //linux - test = "path not a directory: " + new_path.string(); //windows + cerr << "Error: Not a directory or path does not exist." << endl; + test = "path not a directory: " + new_path.string(); return; } @@ -31,9 +30,8 @@ void ReloadDirectory(ftxui::ScreenInteractive& screen, const fs::path& new_path, int i = 1; test = "list dir"; entries.clear(); - for (const auto& entry : fs::directory_iterator(new_path)) { - //test = "got in for loop, new path is " + string(new_path.c_str()); // linux - test = "got in for loop, new path is " + new_path.string(); // windows + for (const auto& entry : fs::directory_iterator(new_path)) { + test = "got in for loop, new path is " + new_path.string(); if (fs::is_directory(entry.path()) || fs::is_regular_file(entry.path())) { i++; std::string name = entry.path().filename().string(); diff --git a/joomer-ftxui-file-browser.vcxproj b/joomer-ftxui-file-browser.vcxproj index 63ad741..ae4eb1f 100644 --- a/joomer-ftxui-file-browser.vcxproj +++ b/joomer-ftxui-file-browser.vcxproj @@ -59,7 +59,7 @@ - +