From 9e36039630db3935e316ecd378e6826f4e5c3a5c Mon Sep 17 00:00:00 2001 From: Mounir IDRASSI Date: Tue, 10 Apr 2018 22:40:16 +0200 Subject: Windows: when extracting files in Setup or Portable mode, decompress zip files docs.zip and Languages.zip in order to have ready to use configuration. --- src/Setup/SelfExtract.c | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/src/Setup/SelfExtract.c b/src/Setup/SelfExtract.c index 8c155c64..9bae2119 100644 --- a/src/Setup/SelfExtract.c +++ b/src/Setup/SelfExtract.c @@ -644,20 +644,38 @@ void __cdecl ExtractAllFilesThread (void *hwndDlg) { wchar_t fileName [TC_MAX_PATH] = {0}; wchar_t filePath [TC_MAX_PATH] = {0}; + BOOL bResult = FALSE, zipFile = FALSE; // Filename StringCchCopyNW (fileName, ARRAYSIZE(fileName), Decompressed_Files[fileNo].fileName, Decompressed_Files[fileNo].fileNameLength); StringCchCopyW (filePath, ARRAYSIZE(filePath), DestExtractPath); StringCchCatW (filePath, ARRAYSIZE(filePath), fileName); + if ((wcslen (fileName) > 4) && (0 == wcscmp (L".zip", &fileName[wcslen(fileName) - 4]))) + zipFile = TRUE; + StatusMessageParam (hwndDlg, "EXTRACTING_VERB", filePath); + if (zipFile) + { + bResult = DecompressZipToDir ( + Decompressed_Files[fileNo].fileContent, + Decompressed_Files[fileNo].fileLength, + DestExtractPath, + CopyMessage, + hwndDlg); + } + else + { + bResult = SaveBufferToFile ( + (char *) Decompressed_Files[fileNo].fileContent, + filePath, + Decompressed_Files[fileNo].fileLength, + FALSE, FALSE); + } + // Write the file - if (!SaveBufferToFile ( - Decompressed_Files[fileNo].fileContent, - filePath, - Decompressed_Files[fileNo].fileLength, - FALSE, FALSE)) + if (!bResult) { wchar_t szTmp[512]; -- cgit v1.2.3