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:
Diffstat (limited to 'qt/build_style/build_style.cpp')
-rw-r--r--qt/build_style/build_style.cpp32
1 files changed, 11 insertions, 21 deletions
diff --git a/qt/build_style/build_style.cpp b/qt/build_style/build_style.cpp
index ddfcfa0ea3..09d393da67 100644
--- a/qt/build_style/build_style.cpp
+++ b/qt/build_style/build_style.cpp
@@ -8,7 +8,7 @@
#include "base/logging.hpp"
-#include "std/exception.hpp"
+#include <exception>
#include <future>
#include <QFile>
@@ -17,35 +17,29 @@
namespace
{
-
QString GetRecalculateGeometryScriptPath()
{
- QString const resourceDir = GetPlatform().ResourcesDir().c_str();
- return resourceDir + "recalculate_geom_index.py";
+ return GetExternalPath("recalculate_geom_index.py", "", "../tools/python");
}
QString GetGeometryToolPath()
{
- QString const resourceDir = GetPlatform().ResourcesDir().c_str();
- return resourceDir + "generator_tool.app/Contents/MacOS/generator_tool";
+ return GetExternalPath("generator_tool", "generator_tool.app/Contents/MacOS", "");
}
QString GetGeometryToolResourceDir()
{
- QString const resourceDir = GetPlatform().ResourcesDir().c_str();
- return resourceDir + "generator_tool.app/Contents/Resources/";
+ return GetExternalPath("", "generator_tool.app/Contents/Resources", "");
}
-
} // namespace
namespace build_style
{
-
void BuildAndApply(QString const & mapcssFile)
{
// Ensure mapcss exists
if (!QFile(mapcssFile).exists())
- throw runtime_error("mapcss files does not exist");
+ throw std::runtime_error("mapcss files does not exist");
QDir const projectDir = QFileInfo(mapcssFile).absoluteDir();
QString const styleDir = projectDir.absolutePath() + QDir::separator();
@@ -53,9 +47,9 @@ void BuildAndApply(QString const & mapcssFile)
// Ensure output directory is clear
if (QDir(outputDir).exists() && !QDir(outputDir).removeRecursively())
- throw runtime_error("Unable to remove the output directory");
+ throw std::runtime_error("Unable to remove the output directory");
if (!QDir().mkdir(outputDir))
- throw runtime_error("Unable to make the output directory");
+ throw std::runtime_error("Unable to make the output directory");
bool const hasSymbols = QDir(styleDir + "symbols/").exists();
if (hasSymbols)
@@ -84,12 +78,9 @@ void RunRecalculationGeometryScript(QString const & mapcssFile)
QString const geometryToolResourceDir = GetGeometryToolResourceDir();
- if (!CopyFile(resourceDir + "drules_proto.bin", geometryToolResourceDir + "drules_proto.bin"))
- throw runtime_error("Cannot copy drawing rules file");
- if (!CopyFile(resourceDir + "classificator.txt", geometryToolResourceDir + "classificator.txt"))
- throw runtime_error("Cannot copy classificator file");
- if (!CopyFile(resourceDir + "types.txt", geometryToolResourceDir + "types.txt"))
- throw runtime_error("Cannot copy types file");
+ CopyFromResources("drules_proto_design.bin", geometryToolResourceDir);
+ CopyFromResources("classificator.txt", geometryToolResourceDir);
+ CopyFromResources("types.txt", geometryToolResourceDir);
QStringList params;
params << "python" <<
@@ -109,10 +100,9 @@ void RunRecalculationGeometryScript(QString const & mapcssFile)
QString msg = QString("System error ") + to_string(res.first).c_str();
if (!res.second.isEmpty())
msg = msg + "\n" + res.second;
- throw runtime_error(to_string(msg));
+ throw std::runtime_error(to_string(msg));
}
}
bool NeedRecalculate = false;
-
} // namespace build_style