File path bug fixed

This commit is contained in:
Xiao Qi 2022-10-31 14:41:28 +08:00
parent eaba73f922
commit a745a410c4
1 changed files with 7 additions and 2 deletions

View File

@ -12,6 +12,7 @@
#include <vector> #include <vector>
#include <filesystem> #include <filesystem>
#include <iostream>
int main(int argc, char* argv[]) int main(int argc, char* argv[])
{ {
@ -21,17 +22,21 @@ int main(int argc, char* argv[])
{ {
if (std::filesystem::is_directory(ASSET_ROOT)) if (std::filesystem::is_directory(ASSET_ROOT))
{ {
for (auto const& dir : std::filesystem::recursive_directory_iterator{ "./Assets/" }) for (auto& dir :
std::filesystem::recursive_directory_iterator{ ASSET_ROOT })
{ {
if (dir.path().extension().string() == GLTF_EXTENSION || if (dir.path().extension().string() == GLTF_EXTENSION ||
dir.path().extension().string() == FBX_EXTENSION) dir.path().extension().string() == FBX_EXTENSION)
{ {
paths.push_back(dir.path().string()); auto path = dir.path();
path.make_preferred();
paths.push_back(path.string());
} }
} }
} }
else else
{ {
std::cout << "Default path not found!" << std::endl;
return 1; return 1;
} }
} }