From 3067ba60aef36ecccde29d7343c6f8186591526e Mon Sep 17 00:00:00 2001 From: Dennis Luxen Date: Wed, 31 Jul 2013 22:05:44 +0200 Subject: [PATCH] convert relative path in server.ini to absolute paths --- Library/OSRM.cpp | 45 ++++++++++++++++++++++++++++++++++++++------- Library/OSRM.h | 1 + 2 files changed, 39 insertions(+), 7 deletions(-) diff --git a/Library/OSRM.cpp b/Library/OSRM.cpp index e656a605c..67fe7500d 100644 --- a/Library/OSRM.cpp +++ b/Library/OSRM.cpp @@ -26,14 +26,45 @@ OSRM::OSRM(const char * 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( - serverConfig.GetParameter("hsgrData"), - serverConfig.GetParameter("ramIndex"), - serverConfig.GetParameter("fileIndex"), - serverConfig.GetParameter("nodesData"), - serverConfig.GetParameter("edgesData"), - serverConfig.GetParameter("namesData"), - serverConfig.GetParameter("timestamp") + boost::filesystem::canonical( + serverConfig.GetParameter("hsgrData"), + base_path, ec ).string(), + boost::filesystem::canonical( + serverConfig.GetParameter("ramIndex"), + base_path, + ec + ).string(), + boost::filesystem::canonical( + serverConfig.GetParameter("fileIndex"), + base_path, + ec + ).string(), + boost::filesystem::canonical( + serverConfig.GetParameter("nodesData"), + base_path, + ec ).string(), + boost::filesystem::canonical( + serverConfig.GetParameter("edgesData"), + base_path, + ec + ).string(), + boost::filesystem::canonical( + serverConfig.GetParameter("namesData"), + base_path, + ec + ).string(), + boost::filesystem::canonical( + serverConfig.GetParameter("timestamp"), + base_path, + ec + ).string() ); RegisterPlugin(new HelloWorldPlugin()); diff --git a/Library/OSRM.h b/Library/OSRM.h index 9a4c601d5..4f505f387 100644 --- a/Library/OSRM.h +++ b/Library/OSRM.h @@ -35,6 +35,7 @@ or see http://www.gnu.org/licenses/agpl.txt. #include "../Server/BasicDatastructures.h" #include +#include #include #include