From b25e102c94914814b5e10d347ab273d11fe91130 Mon Sep 17 00:00:00 2001
From: GH Cao <driver1998.ms@outlook.com>
Date: Sun, 20 Apr 2025 01:51:10 +0800
Subject: [PATCH] adapt msys2 filesystem layout

---
 libaegisub/windows/path_win.cpp | 3 ++-
 src/aegisublocale.cpp           | 1 +
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/libaegisub/windows/path_win.cpp b/libaegisub/windows/path_win.cpp
index c1d21761e..af866fa4d 100644
--- a/libaegisub/windows/path_win.cpp
+++ b/libaegisub/windows/path_win.cpp
@@ -49,7 +49,8 @@ void Path::FillPlatformSpecificPaths() {
 	std::wstring filename(MAX_PATH + 1, L'\0');
 	while (static_cast<DWORD>(filename.size()) == GetModuleFileNameW(nullptr, &filename[0], filename.size()))
 		filename.resize(filename.size() * 2);
-	SetToken("?data", PathFromWString(filename));
+	auto dataDir = PathFromWString(filename).parent_path().parent_path() / "share" / "aegisub";
+	SetToken("?data", dataDir);
 
 	SetToken("?dictionary", Decode("?data/dictionaries"));
 }
diff --git a/src/aegisublocale.cpp b/src/aegisublocale.cpp
index cc5f4e10d..11e4818e5 100644
--- a/src/aegisublocale.cpp
+++ b/src/aegisublocale.cpp
@@ -55,6 +55,7 @@ wxTranslations *AegisubLocale::GetTranslations() {
 	if (!translations) {
 		wxTranslations::Set(translations = new wxTranslations);
 		wxFileTranslationsLoader::AddCatalogLookupPathPrefix(config::path->Decode("?data/locale/").wstring());
+		wxFileTranslationsLoader::AddCatalogLookupPathPrefix(config::path->Decode("?data/../locale/").wstring());
 #if !defined(_WIN32) && !defined(__APPLE__) && !defined(APPIMAGE_BUILD)
 		wxFileTranslationsLoader::AddCatalogLookupPathPrefix(P_LOCALE);
 #endif
-- 
2.49.0

