Skip to content

Commit

Permalink
Remove implicit conversion from std::filesystem::path to std::string
Browse files Browse the repository at this point in the history
  • Loading branch information
flomnes committed Jul 31, 2023
1 parent e518296 commit 03f810f
Showing 1 changed file with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,14 @@

const auto SEP = Yuni::IO::Separator;
using namespace Antares::Data;
using std::filesystem::temp_directory_path;

// Use RAII to simplify teardown
struct ThermalIniFile
{
explicit ThermalIniFile()
{
const auto folder = std::filesystem::temp_directory_path();
const auto folder = temp_directory_path();
std::ofstream outfile(folder / "list.ini", std::ofstream::out | std::ofstream::trunc);

outfile << "[area]" << std::endl;
Expand All @@ -48,7 +49,7 @@ struct ThermalIniFile

~ThermalIniFile() noexcept
{
auto folder = std::filesystem::temp_directory_path();
auto folder = temp_directory_path();
std::filesystem::remove(folder / "list.ini");
}
};
Expand All @@ -57,7 +58,7 @@ struct SeriesFile
{
SeriesFile(const std::string& name, std::size_t size) : name_(name)
{
folder = std::filesystem::temp_directory_path();
folder = temp_directory_path();
std::ofstream outfile(folder / name, std::ofstream::out | std::ofstream::trunc);

for (std::size_t i = 0; i < size; i++)
Expand All @@ -72,7 +73,7 @@ struct SeriesFile
}

std::string getFolder() {
return folder;
return folder.string();
}

private:
Expand Down Expand Up @@ -116,7 +117,7 @@ struct FixtureFull : private ThermalIniFile
study->parameters.include.thermal.minUPTime = true;
study->parameters.include.thermal.minStablePower = true;
study->parameters.include.reserve.spinning = true;
folder = std::filesystem::temp_directory_path();
folder = temp_directory_path().string();
}

std::string folder;
Expand Down

0 comments on commit 03f810f

Please sign in to comment.