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:
-rw-r--r--generator/borders_loader.cpp6
-rw-r--r--local_ads/statistics.cpp5
-rw-r--r--storage/storage.cpp8
-rw-r--r--storage/storage_tests/storage_tests.cpp7
4 files changed, 15 insertions, 11 deletions
diff --git a/generator/borders_loader.cpp b/generator/borders_loader.cpp
index ea3ca96a1b..b5eea50102 100644
--- a/generator/borders_loader.cpp
+++ b/generator/borders_loader.cpp
@@ -18,6 +18,7 @@
#include "coding/read_write_utils.hpp"
#include "coding/file_name_utils.hpp"
+#include "base/exception.hpp"
#include "base/logging.hpp"
#include "base/string_utils.hpp"
@@ -165,9 +166,8 @@ void GeneratePackedBorders(std::string const & baseDir)
void UnpackBorders(std::string const & baseDir, std::string const & targetDir)
{
- Platform & platform = GetPlatform();
- if (!Platform::IsFileExistsByFullPath(targetDir))
- Platform::MkDir(targetDir);
+ if (!Platform::IsFileExistsByFullPath(targetDir) && !Platform::MkDirChecked(targetDir))
+ MYTHROW(FileSystemException, ("Unable to find or create directory", targetDir));
std::vector<storage::CountryDef> countries;
FilesContainerR reader(my::JoinFoldersToPath(baseDir, PACKED_POLYGONS_FILE));
diff --git a/local_ads/statistics.cpp b/local_ads/statistics.cpp
index 2729181c00..e55c44b4c0 100644
--- a/local_ads/statistics.cpp
+++ b/local_ads/statistics.cpp
@@ -14,6 +14,7 @@
#include "geometry/mercator.hpp"
#include "base/assert.hpp"
+#include "base/exception.hpp"
#include "base/logging.hpp"
#include "base/string_utils.hpp"
@@ -138,8 +139,8 @@ std::string StatisticsFolder()
void CreateDirIfNotExist()
{
std::string const statsFolder = StatisticsFolder();
- if (!GetPlatform().IsFileExistsByFullPath(statsFolder))
- Platform::MkDir(statsFolder);
+ if (!GetPlatform().IsFileExistsByFullPath(statsFolder) && !Platform::MkDirChecked(statsFolder))
+ MYTHROW(FileSystemException, ("Unable to find or create directory", statsFolder));
}
std::string MakeRemoteURL(std::string const & userId, std::string const & name, int64_t version)
diff --git a/storage/storage.cpp b/storage/storage.cpp
index 4956578fe8..8c2aa0b662 100644
--- a/storage/storage.cpp
+++ b/storage/storage.cpp
@@ -15,6 +15,7 @@
#include "coding/reader.hpp"
#include "coding/url_encode.hpp"
+#include "base/exception.hpp"
#include "base/gmtime.hpp"
#include "base/logging.hpp"
#include "base/scope_guard.hpp"
@@ -655,8 +656,11 @@ void Storage::LoadCountriesFile(string const & pathToCountriesFile, string const
{
m_dataDir = dataDir;
- if (!m_dataDir.empty())
- Platform::MkDir(my::JoinFoldersToPath(GetPlatform().WritableDir(), m_dataDir));
+ if (!m_dataDir.empty() &&
+ !Platform::MkDirChecked(my::JoinFoldersToPath(GetPlatform().WritableDir(), m_dataDir)))
+ {
+ MYTHROW(FileSystemException, ("Unable to find or create directory", m_dataDir));
+ }
if (m_countries.IsEmpty())
{
diff --git a/storage/storage_tests/storage_tests.cpp b/storage/storage_tests/storage_tests.cpp
index 645e81aa12..8e24bc17f6 100644
--- a/storage/storage_tests/storage_tests.cpp
+++ b/storage/storage_tests/storage_tests.cpp
@@ -38,6 +38,7 @@
#include "defines.hpp"
+#include "base/assert.hpp"
#include "base/scope_guard.hpp"
#include "base/string_utils.hpp"
@@ -1380,10 +1381,8 @@ UNIT_TEST(StorageTest_GetUpdateInfoSingleMwm)
classificator::Load();
WritableDirChanger writableDirChanger(kMapTestDir);
- Platform & platform = GetPlatform();
-
- string const kVersion1Dir = my::JoinFoldersToPath(platform.WritableDir(), "1");
- platform.MkDir(kVersion1Dir);
+ string const kVersion1Dir = my::JoinFoldersToPath(GetPlatform().WritableDir(), "1");
+ CHECK_EQUAL(Platform::MkDir(kVersion1Dir), Platform::ERR_OK, ());
LocalCountryFile country1(kVersion1Dir, CountryFile("OutdatedCountry1"), 1);
LocalCountryFile country2(kVersion1Dir, CountryFile("OutdatedCountry2"), 1);