convert relative path in server.ini to absolute paths

This commit is contained in:
Dennis Luxen 2013-07-31 22:05:44 +02:00
parent c9a756eddc
commit 3067ba60ae
2 changed files with 39 additions and 7 deletions

View File

@ -26,14 +26,45 @@ OSRM::OSRM(const char * server_ini_path) {
} }
BaseConfiguration serverConfig(server_ini_path); BaseConfiguration serverConfig(server_ini_path);
boost::system::error_code ec;
boost::filesystem::path base_path =
boost::filesystem::complete(server_ini_path).parent_path();
objects = new QueryObjectsStorage( objects = new QueryObjectsStorage(
boost::filesystem::canonical(
serverConfig.GetParameter("hsgrData"), serverConfig.GetParameter("hsgrData"),
base_path, ec ).string(),
boost::filesystem::canonical(
serverConfig.GetParameter("ramIndex"), serverConfig.GetParameter("ramIndex"),
base_path,
ec
).string(),
boost::filesystem::canonical(
serverConfig.GetParameter("fileIndex"), serverConfig.GetParameter("fileIndex"),
base_path,
ec
).string(),
boost::filesystem::canonical(
serverConfig.GetParameter("nodesData"), serverConfig.GetParameter("nodesData"),
base_path,
ec ).string(),
boost::filesystem::canonical(
serverConfig.GetParameter("edgesData"), serverConfig.GetParameter("edgesData"),
base_path,
ec
).string(),
boost::filesystem::canonical(
serverConfig.GetParameter("namesData"), serverConfig.GetParameter("namesData"),
serverConfig.GetParameter("timestamp") base_path,
ec
).string(),
boost::filesystem::canonical(
serverConfig.GetParameter("timestamp"),
base_path,
ec
).string()
); );
RegisterPlugin(new HelloWorldPlugin()); RegisterPlugin(new HelloWorldPlugin());

View File

@ -35,6 +35,7 @@ or see http://www.gnu.org/licenses/agpl.txt.
#include "../Server/BasicDatastructures.h" #include "../Server/BasicDatastructures.h"
#include <boost/assert.hpp> #include <boost/assert.hpp>
#include <boost/filesystem.hpp>
#include <boost/noncopyable.hpp> #include <boost/noncopyable.hpp>
#include <boost/thread.hpp> #include <boost/thread.hpp>