string() to make it work for both windows/linux

This commit is contained in:
Jason Ly 2025-12-18 08:53:12 -05:00
parent 57dc748fd0
commit 4b740719ff
2 changed files with 5 additions and 7 deletions

View File

@ -22,8 +22,7 @@ void ReloadDirectory(ftxui::ScreenInteractive& screen, const fs::path& new_path,
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
test = "path not a directory: " + new_path.string();
return;
}
@ -32,8 +31,7 @@ void ReloadDirectory(ftxui::ScreenInteractive& screen, const fs::path& new_path,
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
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();

View File

@ -59,7 +59,7 @@
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="joomer-ftxui-file-browser-win.cpp" />
<ClCompile Include="joomer-ftxui-file-browser.cpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets" />