Commit 01afaa8a authored by Steffen Vogel's avatar Steffen Vogel 🎅🏼
Browse files

use path::string() instead of path::native() which is unsupported on Windows

parent 9e22d68e
...@@ -33,7 +33,7 @@ int main(int argc, char *argv[]) { ...@@ -33,7 +33,7 @@ int main(int argc, char *argv[]) {
String simName = "dpsim"; String simName = "dpsim";
CIMReader reader(simName); CIMReader reader(simName);
SystemTopology sys = reader.loadCIM(args.sysFreq, args.positional, args.solver.domain); SystemTopology sys = reader.loadCIM(args.sysFreq, args.positonalPaths(), args.solver.domain);
Simulation sim(simName, sys, args.timeStep, args.duration, args.solver.domain, args.solver.type); Simulation sim(simName, sys, args.timeStep, args.duration, args.solver.domain, args.solver.type);
......
...@@ -90,6 +90,7 @@ public: ...@@ -90,6 +90,7 @@ public:
DPsim::Timer::StartClock::time_point startTime; DPsim::Timer::StartClock::time_point startTime;
std::list<String> positional; std::list<String> positional;
std::list<fs::path> positonalPaths() const;
std::map<String, Real> options; std::map<String, Real> options;
}; };
......
...@@ -50,7 +50,7 @@ PyObject* Python::LoadCim(PyObject* self, PyObject* args, PyObject *kwargs) { ...@@ -50,7 +50,7 @@ PyObject* Python::LoadCim(PyObject* self, PyObject* args, PyObject *kwargs) {
CPS::Real frequency = 50; CPS::Real frequency = 50;
PyObject *filenames; PyObject *filenames;
PyBytesObject *filename; PyBytesObject *filename;
std::list<String> cimFiles; std::list<fs::path> cimFiles;
int logLevel = (int) CPS::Logger::Level::INFO; int logLevel = (int) CPS::Logger::Level::INFO;
const char *name; const char *name;
...@@ -65,7 +65,7 @@ PyObject* Python::LoadCim(PyObject* self, PyObject* args, PyObject *kwargs) { ...@@ -65,7 +65,7 @@ PyObject* Python::LoadCim(PyObject* self, PyObject* args, PyObject *kwargs) {
PyErr_SetString(PyExc_TypeError, "First argument must be filename or list of filenames"); PyErr_SetString(PyExc_TypeError, "First argument must be filename or list of filenames");
return nullptr; return nullptr;
} }
cimFiles.push_back(PyBytes_AsString((PyObject*) filename)); cimFiles.emplace_back(PyBytes_AsString((PyObject*) filename));
Py_DECREF(filename); Py_DECREF(filename);
} }
} }
......
...@@ -246,6 +246,16 @@ void CommandLineArgs::showCopyright() { ...@@ -246,6 +246,16 @@ void CommandLineArgs::showCopyright() {
std::cout << " Steffen Vogel <StVogel@eonerc.rwth-aachen.de>" << std::endl; std::cout << " Steffen Vogel <StVogel@eonerc.rwth-aachen.de>" << std::endl;
} }
std::list<fs::path> CommandLineArgs::positonalPaths() const {
std::list<fs::path> paths;
for (auto p : positional) {
paths.emplace_back(p);
}
return paths;
}
std::vector<std::string> DPsim::Utils::tokenize(std::string s, char delimiter) { std::vector<std::string> DPsim::Utils::tokenize(std::string s, char delimiter) {
std::vector<std::string> tokens; std::vector<std::string> tokens;
...@@ -306,7 +316,7 @@ fs::path DPsim::Utils::findFile(const fs::path &name, const fs::path &hint, cons ...@@ -306,7 +316,7 @@ fs::path DPsim::Utils::findFile(const fs::path &name, const fs::path &hint, cons
} }
} }
throw std::runtime_error(fmt::format("File not found: {}", name.native())); throw std::runtime_error(fmt::format("File not found: {}", name.string()));
} }
std::list<fs::path> DPsim::Utils::findFiles(std::list<fs::path> filennames, const fs::path &hint, const std::string &useEnv) { std::list<fs::path> DPsim::Utils::findFiles(std::list<fs::path> filennames, const fs::path &hint, const std::string &useEnv) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment