/
githubmirror
/
omim
Обзор
Документация
Войти
/
githubmirror
/
omim
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
qt/build_style/build_statistics.cpp
66 строк
2 KB
Maxim Pimenov
Got rid of the old style std/ includes for several files throughout the project.
19 сен 2019, 10:57
19 сен 2019, 10:57
2dc866c
Код
Авторство
О чём код?
#include "build_statistics.h" #include "build_common.h" #include "platform/platform.hpp" #include <QtCore/QDir> #include <QtCore/QFile> #include <QtCore/QFileInfo> #include <QtCore/QStringList> #include <exception> #include <string> namespace { QString GetScriptPath() { return GetExternalPath("drules_info.py", "kothic/src", "../tools/python/stylesheet"); } } // namespace namespace build_style { QString GetStyleStatistics(QString const & mapcssMappingFile, QString const & drulesFile) { if (!QFile(mapcssMappingFile).exists()) throw std::runtime_error("mapcss-mapping file does not exist"); if (!QFile(drulesFile).exists()) throw std::runtime_error("drawing-rules file does not exist"); // Prepare command line QStringList params; params << "python" << GetScriptPath() << mapcssMappingFile << drulesFile; QString const cmd = params.join(' '); // Add path to the protobuf EGG in the PROTOBUF_EGG_PATH environment variable QProcessEnvironment env = QProcessEnvironment::systemEnvironment(); env.insert("PROTOBUF_EGG_PATH", GetProtobufEggPath()); // Run the script auto const res = ExecProcess(cmd, &env); QString text; if (res.first != 0) { text = QString("System error ") + std::to_string(res.first).c_str(); if (!res.second.isEmpty()) text = text + "\n" + res.second; } else text = res.second; return text; } QString GetCurrentStyleStatistics() { QString const resourceDir = GetPlatform().ResourcesDir().c_str(); QString const mappingPath = JoinPathQt({resourceDir, "mapcss-mapping.csv"}); QString const drulesPath = JoinPathQt({resourceDir, "drules_proto_design.bin"}); return GetStyleStatistics(mappingPath, drulesPath); } } // namespace build_style