more pointer fiddling
This commit is contained in:
parent
560b613ca5
commit
778af44768
@ -5,9 +5,9 @@
|
|||||||
|
|
||||||
static const std::string exclusions[] = {".git", ".obsidian"};
|
static const std::string exclusions[] = {".git", ".obsidian"};
|
||||||
|
|
||||||
std::vector<kc::FileEntry> kc::walk_dir(std::string dir)
|
std::vector<std::shared_ptr<kc::FileEntry>> kc::walk_dir(const std::string dir)
|
||||||
{
|
{
|
||||||
auto matched = std::vector<kc::FileEntry>();
|
auto matched = std::vector<std::shared_ptr<kc::FileEntry>>();
|
||||||
auto base_path = fs::path(dir);
|
auto base_path = fs::path(dir);
|
||||||
|
|
||||||
for (auto const& dir_entry : fs::recursive_directory_iterator(base_path))
|
for (auto const& dir_entry : fs::recursive_directory_iterator(base_path))
|
||||||
@ -23,14 +23,15 @@ std::vector<kc::FileEntry> kc::walk_dir(std::string dir)
|
|||||||
if (dir_entry_path_string.contains(exclusion))
|
if (dir_entry_path_string.contains(exclusion))
|
||||||
{
|
{
|
||||||
excluded = true;
|
excluded = true;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!excluded)
|
if (!excluded)
|
||||||
{
|
{
|
||||||
auto entry = kc::FileEntry(dir_entry);
|
auto entry = std::make_shared<kc::FileEntry>(dir_entry);
|
||||||
|
|
||||||
entry.relative_path = fs::relative(dir_entry_path, base_path);
|
entry->relative_path = fs::relative(dir_entry_path, base_path);
|
||||||
|
|
||||||
matched.push_back(entry);
|
matched.push_back(entry);
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <filesystem>
|
#include <filesystem>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
#include "FileEntry.hpp"
|
#include "FileEntry.hpp"
|
||||||
|
|
||||||
@ -10,6 +11,6 @@ namespace fs = std::filesystem;
|
|||||||
|
|
||||||
namespace kc {
|
namespace kc {
|
||||||
|
|
||||||
std::vector<kc::FileEntry> walk_dir(std::string dir);
|
std::vector<std::shared_ptr<kc::FileEntry>> walk_dir(std::string dir);
|
||||||
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user