From 06888467f39971b9534bc2969afb14f3d38231f1 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 24 Mar 2014 08:25:17 +0000 Subject: fix for broken includes git-svn-id: http://svn.miranda-ng.org/main/trunk@8727 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- src/mir_core/langpack.cpp | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) (limited to 'src/mir_core') 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)) { -- cgit v1.2.3