Skip to content

Commit

Permalink
Merge branch 'main' into CURA-11444_reinterpret_cast
Browse files Browse the repository at this point in the history
  • Loading branch information
casperlamboo committed Feb 21, 2024
2 parents b664e77 + 556df3d commit 1c7a2da
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
7 changes: 3 additions & 4 deletions include/communication/CommandLine.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
#include <filesystem>
#include <rapidjson/document.h> //Loading JSON documents to get settings from them.
#include <string> //To store the command line arguments.
#include <unordered_set>
#include <vector> //To store the command line arguments.

#include "Communication.h" //The class we're implementing.
Expand Down Expand Up @@ -156,7 +155,7 @@ class CommandLine : public Communication
std::string progressHandler;
#endif

std::unordered_set<std::filesystem::path> search_directories_;
std::vector<std::filesystem::path> search_directories_;

/*
* \brief The command line arguments that the application was called with.
Expand Down Expand Up @@ -191,7 +190,7 @@ class CommandLine : public Communication
*/
int loadJSON(
const rapidjson::Document& document,
const std::unordered_set<std::filesystem::path>& search_directories,
const std::vector<std::filesystem::path>& search_directories,
Settings& settings,
bool force_read_parent = false,
bool force_read_nondefault = false);
Expand All @@ -212,7 +211,7 @@ class CommandLine : public Communication
* \param search_directories The directories to search in.
* \return The first definition file that matches the definition ID.
*/
static std::string findDefinitionFile(const std::string& definition_id, const std::unordered_set<std::filesystem::path>& search_directories);
static std::string findDefinitionFile(const std::string& definition_id, const std::vector<std::filesystem::path>& search_directories);
};

} // namespace cura
Expand Down
10 changes: 5 additions & 5 deletions src/communication/CommandLine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ CommandLine::CommandLine(const std::vector<std::string>& arguments)
{
if (auto search_paths = spdlog::details::os::getenv("CURA_ENGINE_SEARCH_PATH"); ! search_paths.empty())
{
search_directories_ = search_paths | views::split_paths | ranges::to<std::unordered_set<std::filesystem::path>>();
search_directories_ = search_paths | views::split_paths | ranges::to<std::vector<std::filesystem::path>>();
};
}

Expand Down Expand Up @@ -242,7 +242,7 @@ void CommandLine::sliceNext()
exit(1);
}
argument = arguments_[argument_index];
search_directories_ = argument | views::split_paths | ranges::to<std::unordered_set<std::filesystem::path>>();
search_directories_ = argument | views::split_paths | ranges::to<std::vector<std::filesystem::path>>();
break;
}
case 'j':
Expand Down Expand Up @@ -420,13 +420,13 @@ int CommandLine::loadJSON(const std::filesystem::path& json_filename, Settings&
return 2;
}

search_directories_.insert(std::filesystem::path(json_filename).parent_path());
search_directories_.push_back(std::filesystem::path(json_filename).parent_path());
return loadJSON(json_document, search_directories_, settings, force_read_parent, force_read_nondefault);
}

int CommandLine::loadJSON(
const rapidjson::Document& document,
const std::unordered_set<std::filesystem::path>& search_directories,
const std::vector<std::filesystem::path>& search_directories,
Settings& settings,
bool force_read_parent,
bool force_read_nondefault)
Expand Down Expand Up @@ -586,7 +586,7 @@ void CommandLine::loadJSONSettings(const rapidjson::Value& element, Settings& se
}
}

std::string CommandLine::findDefinitionFile(const std::string& definition_id, const std::unordered_set<std::filesystem::path>& search_directories)
std::string CommandLine::findDefinitionFile(const std::string& definition_id, const std::vector<std::filesystem::path>& search_directories)
{
for (const auto& search_directory : search_directories)
{
Expand Down

0 comments on commit 1c7a2da

Please sign in to comment.