diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/mir_core/langpack.cpp | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/src/mir_core/langpack.cpp b/src/mir_core/langpack.cpp index 009185407a..cb1d7a01e0 100644 --- a/src/mir_core/langpack.cpp +++ b/src/mir_core/langpack.cpp @@ -214,27 +214,30 @@ static void LoadLangPackFile(FILE *fp, char *line, UINT fileCp) if (!memcmp(line + 1, "include", 7)) {
TCHAR tszFileName[MAX_PATH];
- TCHAR* fileName = mir_a2t(ltrim(line + 9));
- mir_sntprintf(tszFileName, SIZEOF(tszFileName), _T("%s%s"), langPack.tszFullPath, fileName);
- mir_free(fileName);
-
- FILE *p = _tfopen(tszFileName, _T("r"));
- if (p) {
+ TCHAR *p = _tcsrchr(langPack.tszFullPath, '\\');
+ if (p)
+ p[1] = 0;
+ mir_sntprintf(tszFileName, SIZEOF(tszFileName), _T("%s\\%S"), langPack.tszFullPath, ltrim(line + 9));
+ if (p)
+ p[1] = '\\';
+
+ FILE *fp = _tfopen(tszFileName, _T("r"));
+ if (fp) {
line[0] = 0;
- fgets(line, LANGPACK_BUF_SIZE, p);
+ fgets(line, LANGPACK_BUF_SIZE, fp);
UINT fileCp = CP_ACP;
if (strlen(line) >= 3 && line[0] == '\xef' && line[1] == '\xbb' && line[2] == '\xbf') {
fileCp = CP_UTF8;
- fseek(p, 3, SEEK_SET);
+ fseek(fp, 3, SEEK_SET);
}
else {
fileCp = langPack.codepage;
- fseek(p, 0, SEEK_SET);
+ fseek(fp, 0, SEEK_SET);
}
- LoadLangPackFile(p, line, fileCp);
- fclose(p);
+ LoadLangPackFile(fp, line, fileCp);
+ fclose(fp);
}
}
else if (!memcmp(line + 1, "muuid", 5)) {
|