add full path to files

otherwise files can not open if
jpscore is not called from within
the same directory as the inifile
parent 6d70eda4
Pipeline #19415 passed with stages
in 10 minutes and 19 seconds
......@@ -19,11 +19,12 @@
// Created by laemmel on 30.03.16.
//
#include <filesystem>
#include "GeoFileParser.h"
#include "../tinyxml/tinyxml.h"
#include "../geometry/SubRoom.h"
#include "../geometry/WaitingArea.h"
namespace fs = std::filesystem;
......@@ -293,7 +294,11 @@ bool GeoFileParser::LoadGeometry(Building* building)
TiXmlNode * xNodeFile = xTransNode->FirstChild("file");
if(xNodeFile)
{
fs::path p(_configuration->GetProjectRootDir());
std::string transFilename = xNodeFile->FirstChild()->ValueStr();
p /= transFilename;
transFilename = p.string();
Log->Write("INFO:\tParsing transition from file <%s>", transFilename.c_str());
TiXmlDocument docTrans(transFilename);
if (!docTrans.LoadFile()) {
......@@ -383,7 +388,10 @@ bool GeoFileParser::LoadRoutingInfo(Building* building)
TiXmlNode* xGoalsNodeFile = xGoalsNode->FirstChild("file");
if(xGoalsNodeFile)
{
fs::path p(_configuration->GetProjectRootDir());
std::string goalFilename = xGoalsNodeFile->FirstChild()->ValueStr();
p /= goalFilename;
goalFilename = p.string();
Log->Write("INFO:\tGoal file <%s> will be parsed", goalFilename.c_str());
TiXmlDocument docGoal(goalFilename);
if (!docGoal.LoadFile()) {
......@@ -554,7 +562,10 @@ bool GeoFileParser::LoadTrafficInfo(Building* building)
TiXmlNode* xFileNode = xRootNode->FirstChild("file");
if(xFileNode)
{
fs::path p(_configuration->GetProjectRootDir());
std::string trafficFilename = xFileNode->FirstChild()->ValueStr();
p /= trafficFilename;
trafficFilename = p.string();
Log->Write("Info:\t traffic file found <%s>", trafficFilename.c_str());
TiXmlDocument docTraffic(trafficFilename);
if (!docTraffic.LoadFile()) {
......
......@@ -21,6 +21,9 @@
#define NOMINMAX
#include "PedDistributionParser.h"
#include <cstdarg> // va_start and va_end
#include <filesystem>
namespace fs = std::filesystem;
PedDistributionParser::PedDistributionParser(const Configuration* configuration)
:_configuration(configuration)
{
......@@ -174,7 +177,10 @@ bool PedDistributionParser::LoadPedDistribution(vector<std::shared_ptr<StartDist
//------- parse sources from external file
if(xFileNode)
{
fs::path p(_configuration->GetProjectRootDir());
std::string sourceFilename = xFileNode->FirstChild()->ValueStr();
p /= sourceFilename;
sourceFilename = p.string();
Log->Write("Info:\t Source file found <%s>", sourceFilename.c_str());
TiXmlDocument docSource(sourceFilename);
if (!docSource.LoadFile()) {
......
Markdown is supported
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