Windows: move language XML files to new "Languages" folder in the installation directory.

This commit is contained in:
Mounir IDRASSI 2017-06-05 01:38:22 +02:00
parent 0ef137c0a4
commit eb72fe7aa9
No known key found for this signature in database
GPG Key ID: DD0C382D5FCFB8FC
7 changed files with 44 additions and 111 deletions

View File

@ -103,7 +103,7 @@ static char *MapNextLanguageFile ()
if (t == NULL) return NULL; if (t == NULL) return NULL;
*t = 0; *t = 0;
StringCbCatW (f, sizeof(f), L"\\Language*.xml"); StringCbCatW (f, sizeof(f), L"\\Languages\\Language*.xml");
LanguageFileFindHandle = FindFirstFileW (f, &find); LanguageFileFindHandle = FindFirstFileW (f, &find);
} }
@ -130,6 +130,7 @@ static char *MapNextLanguageFile ()
} }
t[1] = 0; t[1] = 0;
StringCbCatW (f, sizeof(f), L"Languages\\");
StringCbCatW (f, sizeof(f),find.cFileName); StringCbCatW (f, sizeof(f),find.cFileName);
file = CreateFileW (f, GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, NULL); file = CreateFileW (f, GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, NULL);

View File

@ -4359,8 +4359,14 @@ BOOL CALLBACK TravelerDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPa
if (strcmp (GetPreferredLangId (), "en") != 0) if (strcmp (GetPreferredLangId (), "en") != 0)
{ {
// Language pack // Language pack
StringCbPrintfW (srcPath, sizeof(srcPath), L"%s\\Language.%hs.xml", appDir, GetPreferredLangId ()); StringCbPrintfW (dstPath, sizeof(dstPath), L"%s\\VeraCrypt\\Languages", dstDir);
StringCbPrintfW (dstPath, sizeof(dstPath), L"%s\\VeraCrypt\\Language.%hs.xml", dstDir, GetPreferredLangId ()); if (!CreateDirectoryW (dstPath, NULL))
{
handleWin32Error (hwndDlg, SRC_POS);
goto stop;
}
StringCbPrintfW (srcPath, sizeof(srcPath), L"%s\\Languages\\Language.%hs.xml", appDir, GetPreferredLangId ());
StringCbPrintfW (dstPath, sizeof(dstPath), L"%s\\VeraCrypt\\Languages\\Language.%hs.xml", dstDir, GetPreferredLangId ());
TCCopyFile (srcPath, dstPath); TCCopyFile (srcPath, dstPath);
} }

View File

@ -1015,14 +1015,15 @@ BOOL DoFilesInstall (HWND hwndDlg, wchar_t *szDestDir)
return FALSE; return FALSE;
} }
} }
// remove PDF from previous version if any
if (bUninstall == FALSE) if (bUninstall == FALSE)
{ {
WIN32_FIND_DATA f; WIN32_FIND_DATA f;
HANDLE h; HANDLE h;
SetCurrentDirectory (szDestDir); SetCurrentDirectory (szDestDir);
// remove PDF from previous version if any
h = FindFirstFile (L"VeraCrypt User Guide*.pdf", &f); h = FindFirstFile (L"VeraCrypt User Guide*.pdf", &f);
if (h != INVALID_HANDLE_VALUE) if (h != INVALID_HANDLE_VALUE)
@ -1036,39 +1037,21 @@ BOOL DoFilesInstall (HWND hwndDlg, wchar_t *szDestDir)
FindClose (h); FindClose (h);
} }
SetCurrentDirectory (SetupFilesDir); // remove language XML files from previous version if any
} h = FindFirstFile (L"Language*.xml", &f);
// Language pack
if (bUninstall == FALSE)
{
WIN32_FIND_DATA f;
HANDLE h;
SetCurrentDirectory (SetupFilesDir);
h = FindFirstFile (L"Language.*.xml", &f);
if (h != INVALID_HANDLE_VALUE) if (h != INVALID_HANDLE_VALUE)
{ {
wchar_t d[MAX_PATH*2]; do
StringCbPrintfW (d, sizeof(d), L"%s%s", szDestDir, f.cFileName); {
CopyMessage (hwndDlg, d); StatDeleteFile (f.cFileName, TRUE);
TCCopyFile (f.cFileName, d); }
while (FindNextFile(h, &f) != 0);
FindClose (h); FindClose (h);
} }
SetCurrentDirectory (SetupFilesDir); SetCurrentDirectory (SetupFilesDir);
SetCurrentDirectory (L"Setup files");
h = FindFirstFile (L"VeraCrypt User Guide.*.chm", &f);
if (h != INVALID_HANDLE_VALUE)
{
wchar_t d[MAX_PATH*2];
StringCbPrintfW (d, sizeof(d), L"%s%s", szDestDir, f.cFileName);
CopyMessage (hwndDlg, d);
TCCopyFile (f.cFileName, d);
FindClose (h);
}
SetCurrentDirectory (SetupFilesDir);
} }
return bOK; return bOK;

View File

@ -37,43 +37,7 @@ static wchar_t *szFiles[]=
L"Averacrypt-x64.sys", L"Averacrypt-x64.sys",
L"Dveracrypt.sys", L"Dveracrypt.sys",
L"AVeraCrypt Setup.exe", L"AVeraCrypt Setup.exe",
L"ALanguage.ar.xml", L"XLanguages.zip",
L"ALanguage.be.xml",
L"ALanguage.bg.xml",
L"ALanguage.ca.xml",
L"ALanguage.cs.xml",
L"ALanguage.da.xml",
L"ALanguage.de.xml",
L"ALanguage.el.xml",
L"ALanguage.es.xml",
L"ALanguage.et.xml",
L"ALanguage.eu.xml",
L"ALanguage.fa.xml",
L"ALanguage.fi.xml",
L"ALanguage.fr.xml",
L"ALanguage.hu.xml",
L"ALanguage.id.xml",
L"ALanguage.it.xml",
L"ALanguage.ja.xml",
L"ALanguage.ka.xml",
L"ALanguage.ko.xml",
L"ALanguage.lv.xml",
L"ALanguage.my.xml",
L"ALanguage.nl.xml",
L"ALanguage.nn.xml",
L"ALanguage.pl.xml",
L"ALanguage.pt-br.xml",
L"ALanguage.ru.xml",
L"ALanguage.sk.xml",
L"ALanguage.sl.xml",
L"ALanguage.sv.xml",
L"ALanguage.tr.xml",
L"ALanguage.uk.xml",
L"ALanguage.uz.xml",
L"ALanguage.vi.xml",
L"ALanguage.zh-cn.xml",
L"ALanguage.zh-hk.xml",
L"ALanguage.zh-tw.xml",
L"Xdocs.zip", L"Xdocs.zip",
}; };
@ -91,43 +55,7 @@ static wchar_t *szCompressedFiles[]=
L"VeraCrypt Format-x64.exe", L"VeraCrypt Format-x64.exe",
L"veracrypt.sys", L"veracrypt.sys",
L"veracrypt-x64.sys", L"veracrypt-x64.sys",
L"Language.ar.xml", L"Languages.zip",
L"Language.be.xml",
L"Language.bg.xml",
L"Language.ca.xml",
L"Language.cs.xml",
L"Language.da.xml",
L"Language.de.xml",
L"Language.el.xml",
L"Language.es.xml",
L"Language.et.xml",
L"Language.eu.xml",
L"Language.fa.xml",
L"Language.fi.xml",
L"Language.fr.xml",
L"Language.hu.xml",
L"Language.id.xml",
L"Language.it.xml",
L"Language.ja.xml",
L"Language.ka.xml",
L"Language.ko.xml",
L"Language.lv.xml",
L"Language.my.xml",
L"Language.nl.xml",
L"Language.nn.xml",
L"Language.pl.xml",
L"Language.pt-br.xml",
L"Language.ru.xml",
L"Language.sk.xml",
L"Language.sl.xml",
L"Language.sv.xml",
L"Language.tr.xml",
L"Language.uk.xml",
L"Language.uz.xml",
L"Language.vi.xml",
L"Language.zh-cn.xml",
L"Language.zh-hk.xml",
L"Language.zh-tw.xml",
L"docs.zip" L"docs.zip"
}; };

View File

@ -23,7 +23,11 @@ copy ..\..\License.txt .
copy ..\..\NOTICE . copy ..\..\NOTICE .
del *.xml del *.xml
copy /V /Y ..\..\..\Translations\*.xml . rmdir /S /Q Languages
mkdir Languages
copy /V /Y ..\..\..\Translations\*.xml Languages\.
del Languages.zip
7z a -y Languages.zip Languages
rmdir /S /Q docs rmdir /S /Q docs
mkdir docs\html\en mkdir docs\html\en
@ -40,8 +44,9 @@ del License.txt
del NOTICE del NOTICE
del "VeraCrypt User Guide.chm" del "VeraCrypt User Guide.chm"
del *.xml del Languages.zip
del docs.zip del docs.zip
rmdir /S /Q Languages
rmdir /S /Q docs rmdir /S /Q docs
cd %SIGNINGPATH% cd %SIGNINGPATH%

View File

@ -27,7 +27,11 @@ copy ..\..\License.txt .
copy ..\..\NOTICE . copy ..\..\NOTICE .
del *.xml del *.xml
copy /V /Y ..\..\..\Translations\*.xml . rmdir /S /Q Languages
mkdir Languages
copy /V /Y ..\..\..\Translations\*.xml Languages\.
del Languages.zip
7z a -y Languages.zip Languages
rmdir /S /Q docs rmdir /S /Q docs
mkdir docs\html\en mkdir docs\html\en
@ -44,8 +48,9 @@ del License.txt
del NOTICE del NOTICE
del "VeraCrypt User Guide.chm" del "VeraCrypt User Guide.chm"
del *.xml del Languages.zip
del docs.zip del docs.zip
rmdir /S /Q Languages
rmdir /S /Q docs rmdir /S /Q docs
cd %SIGNINGPATH% cd %SIGNINGPATH%

View File

@ -27,7 +27,11 @@ copy ..\..\License.txt .
copy ..\..\NOTICE . copy ..\..\NOTICE .
del *.xml del *.xml
copy /V /Y ..\..\..\Translations\*.xml . rmdir /S /Q Languages
mkdir Languages
copy /V /Y ..\..\..\Translations\*.xml Languages\.
del Languages.zip
7z a -y Languages.zip Languages
rmdir /S /Q docs rmdir /S /Q docs
mkdir docs\html\en mkdir docs\html\en
@ -44,8 +48,9 @@ del License.txt
del NOTICE del NOTICE
del "VeraCrypt User Guide.chm" del "VeraCrypt User Guide.chm"
del *.xml del Languages.zip
del docs.zip del docs.zip
rmdir /S /Q Languages
rmdir /S /Q docs rmdir /S /Q docs
cd %SIGNINGPATH% cd %SIGNINGPATH%