Skip to content

Commit

Permalink
Fix study not found on windows when using simulator API (#2481)
Browse files Browse the repository at this point in the history
Fix an issue when using simulator API on windows where windows path with
drive letter were unsuported
  • Loading branch information
a-zakir authored Nov 4, 2024
1 parent 4128112 commit 94703f4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
namespace Antares
{
FileTreeStudyLoader::FileTreeStudyLoader(std::filesystem::path study_path):
study_path_{std::move(study_path)}
study_path_{std::move(study_path.string())}
{
}

Expand All @@ -38,10 +38,7 @@ std::unique_ptr<Antares::Data::Study> FileTreeStudyLoader::load() const
using namespace std::literals::string_literals;
Antares::Solver::Application application;
constexpr unsigned int argc = 3;
// On Windows, std::filesystem::path::value_type is wchar_t
std::array<const char*, argc> argv{"",
reinterpret_cast<const char*>(study_path_.c_str()),
"--parallel"};
std::array<const char*, argc> argv{"", study_path_.c_str(), "--parallel"};
application.prepare(argc, argv.data());

return application.acquireStudy();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,6 @@ class FileTreeStudyLoader: public IStudyLoader
[[nodiscard]] std::unique_ptr<Antares::Data::Study> load() const override;

private:
std::filesystem::path study_path_;
std::string study_path_;
};
} // namespace Antares

0 comments on commit 94703f4

Please sign in to comment.