From 6c4cc1bb03819b0b5a20857aab3b35922fb08e2c Mon Sep 17 00:00:00 2001 From: Denis Koronchik Date: Wed, 8 Oct 2014 12:07:49 +0300 Subject: [PATCH] [routing] Add return code for non-existing routing file --- routing/osrm_router.cpp | 6 ++++++ routing/router.hpp | 1 + 2 files changed, 7 insertions(+) diff --git a/routing/osrm_router.cpp b/routing/osrm_router.cpp index 7fea6843cd..bdd1558b1f 100644 --- a/routing/osrm_router.cpp +++ b/routing/osrm_router.cpp @@ -253,6 +253,9 @@ void OsrmRouter::CalculateRouteAsync(ReadyCallback const & callback) case RouteNotFound: LOG(LWARNING, ("Route not found")); break; + case RouteFileNotExist: + LOG(LWARNING, ("There are no routing file")); + break; default: break; @@ -298,6 +301,9 @@ OsrmRouter::ResultCode OsrmRouter::CalculateRouteImpl(m2::PointD const & startPt fName += DATA_FILE_EXTENSION; string const fPath = pl.WritablePathForFile(fName + ROUTING_FILE_EXTENSION); + if (!pl.IsFileExistsByFullPath(fPath)) + return RouteFileNotExist; + if (NeedReload(fPath)) { LOG(LDEBUG, ("Load routing index for file:", fPath)); diff --git a/routing/router.hpp b/routing/router.hpp index 43a57d1899..ff12d8a836 100644 --- a/routing/router.hpp +++ b/routing/router.hpp @@ -19,6 +19,7 @@ public: NoError = 0, Cancelled, InconsistentMWMandRoute, + RouteFileNotExist, StartPointNotFound, EndPointNotFound, PointsInDifferentMWM,