[data] Refactor resources folder

Signed-off-by: Andrei Shkrob <github@shkrob.dev>
This commit is contained in:
Andrei Shkrob
2025-07-08 18:38:28 +02:00
committed by Konstantin Pastbin
parent 04246a55f2
commit 8f5c8a5bd7
71 changed files with 62 additions and 283 deletions

View File

@@ -7,8 +7,8 @@
namespace
{
std::string const kSuffixDark = "_dark";
std::string const kSuffixLight = "_light";
std::string const kSuffixDark = "dark";
std::string const kSuffixLight = "light";
std::string const kSuffixDefaultDark = "_default_dark";
std::string const kSuffixDefaultLight = "_default_light";
std::string const kSuffixVehicleDark = "_vehicle_dark";
@@ -42,7 +42,7 @@ std::string GetStyleRulesSuffix(MapStyle mapStyle)
case MapStyleOutdoorsDark:
return kSuffixOutdoorsDark;
case MapStyleMerged:
return std::string();
return {};
case MapStyleCount:
break;
@@ -70,7 +70,7 @@ std::string GetStyleResourcesSuffix(MapStyle mapStyle)
case MapStyleOutdoorsLight:
return kSuffixLight;
case MapStyleMerged:
return std::string();
return {};
case MapStyleCount:
break;
@@ -122,9 +122,7 @@ ReaderPtr<Reader> StyleReader::GetDrawingRulesReader() const
ReaderPtr<Reader> StyleReader::GetResourceReader(std::string const & file,
std::string_view density) const
{
std::string const resourceDir =
std::string("resources-").append(density) + GetStyleResourcesSuffix(GetCurrentStyle());
std::string resFile = base::JoinPath(resourceDir, file);
std::string resFile = base::JoinPath("symbols", std::string{density}, GetStyleResourcesSuffix(GetCurrentStyle()), file);
auto overriddenResFile = base::JoinPath(GetPlatform().WritableDir(), kStylesOverrideDir, resFile);
if (GetPlatform().IsFileExistsByFullPath(overriddenResFile))
@@ -140,7 +138,7 @@ ReaderPtr<Reader> StyleReader::GetResourceReader(std::string const & file,
ReaderPtr<Reader> StyleReader::GetDefaultResourceReader(std::string const & file) const
{
return GetPlatform().GetReader(base::JoinPath("resources-default", file));
return GetPlatform().GetReader(base::JoinPath("symbols/default", file));
}
StyleReader & GetStyleReader()