From 5b03366909f4ec4a6d9764c0b7c005d35b533ec0 Mon Sep 17 00:00:00 2001 From: Dennis Luxen Date: Tue, 1 Oct 2013 17:37:52 +0200 Subject: [PATCH] checking if data files actually exist --- Server/DataStructures/InternalDataFacade.h | 19 +++++++++++++++++++ datastore.cpp | 18 ++++++++++++++++++ 2 files changed, 37 insertions(+) diff --git a/Server/DataStructures/InternalDataFacade.h b/Server/DataStructures/InternalDataFacade.h index efba74fdd..f1b5d3005 100644 --- a/Server/DataStructures/InternalDataFacade.h +++ b/Server/DataStructures/InternalDataFacade.h @@ -249,6 +249,25 @@ public: base_path ); + if ( !boost::filesystem::exists(hsgr_path) ) { + throw(".hsgr not found"); + } + if ( !boost::filesystem::exists(ram_index_path) ) { + throw(".ramIndex not found"); + } + if ( !boost::filesystem::exists(file_index_path) ) { + throw(".fileIndex not found"); + } + if ( !boost::filesystem::exists(node_data_path) ) { + throw(".nodes not found"); + } + if ( !boost::filesystem::exists(edge_data_path) ) { + throw(".edges not found"); + } + if ( !boost::filesystem::exists(name_data_path) ) { + throw(".names not found"); + } + // check if data files empty if ( 0 == boost::filesystem::file_size( node_data_path ) ) { throw OSRMException("nodes file is empty"); diff --git a/datastore.cpp b/datastore.cpp index fe9782a3b..2d1bf8947 100644 --- a/datastore.cpp +++ b/datastore.cpp @@ -86,6 +86,24 @@ int main(int argc, char * argv[]) { base_path ); + //check if data files actually exist + if ( !boost::filesystem::exists(hsgr_path) ) { + throw(".hsgr not found"); + } + if ( !boost::filesystem::exists(ram_index_path) ) { + throw(".ramIndex not found"); + } + if ( !boost::filesystem::exists(node_data_path) ) { + throw(".nodes not found"); + } + if ( !boost::filesystem::exists(edge_data_path) ) { + throw(".edges not found"); + } + if ( !boost::filesystem::exists(name_data_path) ) { + throw(".names not found"); + } + + // check if data files empty if ( 0 == boost::filesystem::file_size( node_data_path ) ) { throw OSRMException("nodes file is empty");