Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Zolotarev <deathbaba@gmail.com>2011-10-10 20:36:06 +0400
committerAlex Zolotarev <alex@maps.me>2015-09-23 01:25:47 +0300
commit3a44c1350155cb0428f294546e0816f09a126dd7 (patch)
tree4e2f016cbfea8fdf49777b78ce4998fa2fbe0fb7 /platform/platform_android.cpp
parentdfa35b34e0c89e444e21e6ba293903232c3111b9 (diff)
[android] Fixed recursion with GetReader
Diffstat (limited to 'platform/platform_android.cpp')
-rw-r--r--platform/platform_android.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/platform/platform_android.cpp b/platform/platform_android.cpp
index d2dc7874a5..f85780d697 100644
--- a/platform/platform_android.cpp
+++ b/platform/platform_android.cpp
@@ -5,6 +5,7 @@
#include <dirent.h>
#include <unistd.h>
+#include <sys/stat.h>
static string ReadPathForFile(string const & writableDir,
string const & resourcesDir, string const & file)
@@ -25,9 +26,16 @@ Platform::Platform()
Platform::~Platform()
{}
+static bool IsFilePresent(string const & file)
+{
+ struct stat s;
+ return stat(file.c_str(), &s) == 0;
+}
+
ModelReader * Platform::GetReader(string const & file) const
{
- if (IsFileExists(m_writableDir + file))
+ // can't use Platform::IsFileExists here to avoid recursion
+ if (IsFilePresent(m_writableDir + file))
return new FileReader(ReadPathForFile(m_writableDir, m_resourcesDir, file), 10, 12);
else
{ // paths from GetFilesInDir will already contain "assets/"
@@ -125,7 +133,7 @@ bool Platform::GetFileSize(string const & file, uint64_t & size) const
size = ReaderPtr<Reader>(GetReader(file)).Size();
return true;
}
- catch (RootException)
+ catch (RootException const &)
{
return false;
}