diff options
author | George Hazan <george.hazan@gmail.com> | 2014-07-06 22:24:53 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2014-07-06 22:24:53 +0000 |
commit | d708c4c39966e9a1a07a4cd97a3684f1dfa5a25e (patch) | |
tree | a3c7476b2c45ef66d63dd0027e4902bffa95ad31 /src/mir_core | |
parent | 554346643f6b22f4d0c2420034a39d61b62feaa3 (diff) |
return to the relative langpack's file names
git-svn-id: http://svn.miranda-ng.org/main/trunk@9718 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src/mir_core')
-rw-r--r-- | src/mir_core/langpack.cpp | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/src/mir_core/langpack.cpp b/src/mir_core/langpack.cpp index 43f0a42119..94ca9eff2e 100644 --- a/src/mir_core/langpack.cpp +++ b/src/mir_core/langpack.cpp @@ -48,6 +48,7 @@ struct LangPackEntry };
static LANGPACK_INFO langPack;
+static TCHAR g_tszRoot[MAX_PATH];
static LangPackEntry *g_pEntries;
static int g_entryCount, g_entriesAlloced;
@@ -377,11 +378,10 @@ MIR_CORE_DLL(int) LoadLangPack(const TCHAR *ptszLangPack) // ensure that a lang's name is a full file name
TCHAR tszFullPath[MAX_PATH];
- if (!PathIsAbsoluteT(ptszLangPack)) {
- PathToAbsoluteT(_T("\\Languages\\"), tszFullPath);
- _tcsncat_s(tszFullPath, SIZEOF(tszFullPath), ptszLangPack, _TRUNCATE);
- }
- else _tcsncpy_s(tszFullPath, SIZEOF(tszFullPath), ptszLangPack, _TRUNCATE);
+ if (!PathIsAbsoluteT(ptszLangPack))
+ mir_sntprintf(tszFullPath, SIZEOF(tszFullPath), _T("%s\\%s"), g_tszRoot, ptszLangPack);
+ else
+ _tcsncpy_s(tszFullPath, SIZEOF(tszFullPath), ptszLangPack, _TRUNCATE);
// this lang is already loaded? nothing to do then
if (!lstrcmp(tszFullPath, langPack.tszFullPath))
@@ -640,18 +640,20 @@ MIR_CORE_DLL(int) LoadLangPackModule(void) hevChanged = CreateHookableEvent(ME_LANGPACK_CHANGED);
+ // calculate the langpacks' root
+ PathToAbsoluteT(_T("\\Languages"), g_tszRoot);
+ if (_taccess(g_tszRoot, 0) != 0) // directory Languages exists
+ PathToAbsoluteT(_T("."), g_tszRoot);
+
// look into mirandaboot.ini
- TCHAR tszDefaultLang[100], tszPath[MAX_PATH], tszRoot[MAX_PATH];
+ TCHAR tszDefaultLang[100], tszPath[MAX_PATH];
PathToAbsoluteT(_T("\\mirandaboot.ini"), tszPath);
if (GetPrivateProfileString(_T("Language"), _T("DefaultLanguage"), _T(""), tszDefaultLang, SIZEOF(tszDefaultLang), tszPath))
if (!LoadLangPack(tszDefaultLang))
return 0;
// finally try to load first file
- PathToAbsoluteT(_T("\\Languages"), tszRoot);
- if (_taccess(tszRoot, 0) != 0) // directory Languages exists
- PathToAbsoluteT(_T("."), tszRoot);
- mir_sntprintf(tszPath, SIZEOF(tszPath), _T("%s\\langpack_*.txt"), tszRoot);
+ mir_sntprintf(tszPath, SIZEOF(tszPath), _T("%s\\langpack_*.txt"), g_tszRoot);
WIN32_FIND_DATA fd;
HANDLE hFind = FindFirstFile(tszPath, &fd);
@@ -661,8 +663,7 @@ MIR_CORE_DLL(int) LoadLangPackModule(void) if (fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
continue;
- mir_sntprintf(tszPath, SIZEOF(tszPath), _T("%s\\%s"), tszRoot, fd.cFileName);
- if (!LoadLangPack(tszPath)) {
+ if (!LoadLangPack(fd.cFileName)) {
db_set_ts(NULL, "Langpack", "Current", fd.cFileName);
break;
}
|