5#ifndef TILESON_PROJECTFOLDER_HPP
6#define TILESON_PROJECTFOLDER_HPP
15 inline const fs::path &
getPath()
const;
17 inline const std::vector<ProjectFolder> &
getSubFolders()
const;
18 inline const std::vector<fs::path> &
getFiles()
const;
22 inline void loadData();
26 std::vector<ProjectFolder> m_subFolders;
27 std::vector<fs::path> m_files;
36 void ProjectFolder::loadData()
38 m_hasWorldFile =
false;
43 for (
const auto & entry : fs::directory_iterator(m_path))
45 if(fs::is_regular_file(entry.path()))
47 if(entry.path().extension() ==
".world")
49 m_hasWorldFile =
true;
50 worldPath = entry.path();
56 m_world.
parse(worldPath);
58 for (
const auto & entry : fs::directory_iterator(m_path))
60 if (fs::is_directory(entry.path()))
61 m_subFolders.emplace_back(entry.path());
62 else if (fs::is_regular_file(entry.path()))
64 if(m_hasWorldFile && m_world.
contains(entry.path().filename().generic_string()))
65 m_files.emplace_back(entry.path());
66 else if(!m_hasWorldFile)
67 m_files.emplace_back(entry.path());
80 return m_hasWorldFile;
Definition ProjectFolder.hpp:11
const fs::path & getPath() const
Definition ProjectFolder.hpp:73
const World & getWorld() const
Definition ProjectFolder.hpp:97
const std::vector< ProjectFolder > & getSubFolders() const
Definition ProjectFolder.hpp:83
ProjectFolder(const fs::path &path)
Definition ProjectFolder.hpp:31
bool hasWorldFile() const
Definition ProjectFolder.hpp:78
const std::vector< fs::path > & getFiles() const
Definition ProjectFolder.hpp:88
bool parse(const fs::path &path)
Definition World.hpp:58
bool contains(std::string_view filename)
Definition World.hpp:113