Skip to content
Snippets Groups Projects
Commit b320ebc8 authored by Andrea Zoli's avatar Andrea Zoli
Browse files

Generating stream file in the same path of the xml.

parent 0bb312cd
No related branches found
No related tags found
No related merge requests found
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include "XmlConfig.h" #include "XmlConfig.h"
#include <unistd.h> #include <unistd.h>
#include <string> #include <string>
#include <algorithm>
using namespace PacketLib; using namespace PacketLib;
...@@ -45,12 +46,16 @@ bool ConfigurationFile::open(char** parameters) throw(PacketExceptionIO*) ...@@ -45,12 +46,16 @@ bool ConfigurationFile::open(char** parameters) throw(PacketExceptionIO*)
if(std::string(parameters[0]).find(".xml") != std::string::npos) if(std::string(parameters[0]).find(".xml") != std::string::npos)
{ {
std::string confdir(parameters[0]);
confdir.erase(std::find(confdir.rbegin(), confdir.rend(), '/').base(), confdir.end());
chdir(confdir.c_str());
XmlConfig config; XmlConfig config;
std::string streamfile = config.convert(parameters[0]); std::string streamfile = confdir + config.convert(parameters[0]);
int size = streamfile.size(); int size = streamfile.size();
parameters[0] = new char[size]; parameters[0] = new char[size];
memcpy(parameters[0], streamfile.c_str(), size); memcpy(parameters[0], streamfile.c_str(), size);
parameters[0][size] = 0; parameters[0][size] = 0;
chdir(currentpwd);
} }
ret = InputTextFile::open(parameters); ret = InputTextFile::open(parameters);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment