mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-01 03:21:41 +00:00
Build localization path using VFS::Path::Normalized
This commit is contained in:
parent
84adb0a148
commit
ffbeb5ab98
@ -72,6 +72,13 @@ namespace VFS::Path
|
||||
EXPECT_EQ(value.value(), "foo/bar/baz");
|
||||
}
|
||||
|
||||
TEST(NormalizedTest, shouldSupportOperatorDivEqualWithStringView)
|
||||
{
|
||||
Normalized value("foo/bar");
|
||||
value /= std::string_view("BAZ");
|
||||
EXPECT_EQ(value.value(), "foo/bar/baz");
|
||||
}
|
||||
|
||||
TEST(NormalizedTest, changeExtensionShouldReplaceAfterLastDot)
|
||||
{
|
||||
Normalized value("foo/bar.a");
|
||||
|
@ -36,11 +36,13 @@ namespace l10n
|
||||
|
||||
void Manager::readLangData(const std::string& name, MessageBundles& ctx, const icu::Locale& lang)
|
||||
{
|
||||
std::string path = "l10n/";
|
||||
path.append(name);
|
||||
path.append("/");
|
||||
path.append(lang.getName());
|
||||
path.append(".yaml");
|
||||
std::string langName(lang.getName());
|
||||
langName += ".yaml";
|
||||
|
||||
VFS::Path::Normalized path("l10n");
|
||||
path /= name;
|
||||
path /= langName;
|
||||
|
||||
if (!mVFS->exists(path))
|
||||
return;
|
||||
|
||||
|
@ -187,6 +187,16 @@ namespace VFS::Path
|
||||
return *this;
|
||||
}
|
||||
|
||||
Normalized& operator/=(std::string_view value)
|
||||
{
|
||||
mValue.reserve(mValue.size() + value.size() + 1);
|
||||
mValue += separator;
|
||||
const std::size_t offset = mValue.size();
|
||||
mValue += value;
|
||||
normalizeFilenameInPlace(mValue.begin() + offset, mValue.end());
|
||||
return *this;
|
||||
}
|
||||
|
||||
friend bool operator==(const Normalized& lhs, const Normalized& rhs) = default;
|
||||
|
||||
friend bool operator==(const Normalized& lhs, const auto& rhs) { return lhs.mValue == rhs; }
|
||||
|
Loading…
Reference in New Issue
Block a user