string() to make it work for both windows/linux
This commit is contained in:
parent
57dc748fd0
commit
4b740719ff
@ -21,9 +21,8 @@ void ReloadDirectory(ftxui::ScreenInteractive& screen, const fs::path& new_path,
|
|||||||
// Check if the path is a valid directory
|
// Check if the path is a valid directory
|
||||||
if (!fs::exists(new_path) || !fs::is_directory(new_path)) {
|
if (!fs::exists(new_path) || !fs::is_directory(new_path)) {
|
||||||
// Handle error case (optional: display a warning in the TUI)
|
// Handle error case (optional: display a warning in the TUI)
|
||||||
cerr << "Error: Not a directory or path does not exist." << endl;
|
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();
|
||||||
test = "path not a directory: " + new_path.string(); //windows
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -31,9 +30,8 @@ void ReloadDirectory(ftxui::ScreenInteractive& screen, const fs::path& new_path,
|
|||||||
int i = 1;
|
int i = 1;
|
||||||
test = "list dir";
|
test = "list dir";
|
||||||
entries.clear();
|
entries.clear();
|
||||||
for (const auto& entry : fs::directory_iterator(new_path)) {
|
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();
|
||||||
test = "got in for loop, new path is " + new_path.string(); // windows
|
|
||||||
if (fs::is_directory(entry.path()) || fs::is_regular_file(entry.path())) {
|
if (fs::is_directory(entry.path()) || fs::is_regular_file(entry.path())) {
|
||||||
i++;
|
i++;
|
||||||
std::string name = entry.path().filename().string();
|
std::string name = entry.path().filename().string();
|
||||||
|
|||||||
@ -59,7 +59,7 @@
|
|||||||
</PostBuildEvent>
|
</PostBuildEvent>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="joomer-ftxui-file-browser-win.cpp" />
|
<ClCompile Include="joomer-ftxui-file-browser.cpp" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
<ImportGroup Label="ExtensionTargets" />
|
<ImportGroup Label="ExtensionTargets" />
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user