Skip to content

Commit

Permalink
Make archive files comparable as text files when failied to extract a…
Browse files Browse the repository at this point in the history
…rchive files #1020,  #1024
  • Loading branch information
sdottaka committed Mar 18, 2022
1 parent b2e416a commit 54ef361
Show file tree
Hide file tree
Showing 44 changed files with 176 additions and 46 deletions.
14 changes: 9 additions & 5 deletions Src/7zCommon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -614,7 +614,8 @@ DecompressResult DecompressArchive(HWND hWnd, const PathContext& files)
res.files[1].erase();
do
{
if (FAILED(piHandler->DeCompressArchive(hWnd, res.files[0].c_str(), path.c_str())))
res.hr = piHandler->DeCompressArchive(hWnd, res.files[0].c_str(), path.c_str());
if (FAILED(res.hr))
break;
if (res.files[0].find(path) == 0)
{
Expand Down Expand Up @@ -642,8 +643,9 @@ DecompressResult DecompressArchive(HWND hWnd, const PathContext& files)
path = env::GetTempChildPath();
do
{
if (FAILED(piHandler->DeCompressArchive(hWnd, res.files[1].c_str(), path.c_str())))
break;;
res.hr = piHandler->DeCompressArchive(hWnd, res.files[1].c_str(), path.c_str());
if (FAILED(res.hr))
break;
if (res.files[1].find(path) == 0)
{
VERIFY(::DeleteFile(res.files[1].c_str()) || (LogErrorString(strutils::format(_T("DeleteFile(%s) failed"), res.files[1])), false));
Expand All @@ -669,8 +671,9 @@ DecompressResult DecompressArchive(HWND hWnd, const PathContext& files)
path = env::GetTempChildPath();
do
{
if (FAILED(piHandler->DeCompressArchive(hWnd, res.files[2].c_str(), path.c_str())))
break;;
res.hr = piHandler->DeCompressArchive(hWnd, res.files[2].c_str(), path.c_str());
if (FAILED(res.hr))
break;
if (res.files[2].find(path) == 0)
{
VERIFY(::DeleteFile(res.files[2].c_str()) || (LogErrorString(strutils::format(_T("DeleteFile(%s) failed"), res.files[2])), false));
Expand Down Expand Up @@ -704,6 +707,7 @@ DecompressResult DecompressArchive(HWND hWnd, const PathContext& files)
}
catch (CException *e)
{
res.hr = E_FAIL;
e->Delete();
}
return res;
Expand Down
3 changes: 2 additions & 1 deletion Src/7zCommon.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,12 @@ int NTAPI HasZipSupport();
struct DecompressResult
{
DecompressResult(const PathContext& files, CTempPathContext *pTempPathContext, paths::PATH_EXISTENCE pathsType) :
files(files), pTempPathContext(pTempPathContext), pathsType(pathsType)
files(files), pTempPathContext(pTempPathContext), pathsType(pathsType), hr(S_OK)
{
}
PathContext files;
CTempPathContext *pTempPathContext;
paths::PATH_EXISTENCE pathsType;
HRESULT hr;
};
DecompressResult DecompressArchive(HWND hWnd, const PathContext& infiles);
12 changes: 11 additions & 1 deletion Src/MainFrm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1260,7 +1260,17 @@ bool CMainFrame::DoFileOrFolderOpen(const PathContext * pFiles /*= nullptr*/,
CTempPathContext *pTempPathContext = nullptr;
if (nID == 0 && pathsType == paths::IS_EXISTING_DIR)
{
DecompressResult res= DecompressArchive(m_hWnd, tFiles);
DecompressResult res = DecompressArchive(m_hWnd, tFiles);
if (FAILED(res.hr))
{
int ans = AfxMessageBox(IDS_FAILED_EXTRACT_ARCHIVE_FILES, MB_YESNO | MB_DONT_ASK_AGAIN | MB_ICONWARNING, IDS_FAILED_EXTRACT_ARCHIVE_FILES);
if (ans == IDYES)
{
pathsType = paths::IS_EXISTING_FILE;
delete res.pTempPathContext;
res.pTempPathContext = nullptr;
}
}
if (res.pTempPathContext)
{
pathsType = res.pathsType;
Expand Down
1 change: 1 addition & 0 deletions Src/Merge.rc
Original file line number Diff line number Diff line change
Expand Up @@ -3319,6 +3319,7 @@ END
STRINGTABLE
BEGIN
IDS_UNKNOWN_ARCHIVE_FORMAT "Unknown archive format"
IDS_FAILED_EXTRACT_ARCHIVE_FILES "Failed to extract archive files.\nDo you want to compare the archive files as text files?"
END

// DIRECTORY DIFFING : COLUMN TITLES #1
Expand Down
2 changes: 2 additions & 0 deletions Src/PropMessageBoxes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ static struct MessageBox
{ IDS_CANNOT_CREATE_BINARYPATCH, IDS_CANNOT_CREATE_BINARYPATCH, nullptr, MB_ICONWARNING | MB_DONT_DISPLAY_AGAIN },
{ IDS_DIFF_FILEOVERWRITE, IDS_DIFF_FILEOVERWRITE, nullptr, MB_YESNO | MB_ICONWARNING | MB_DONT_ASK_AGAIN },
{ IDS_DIFF_SUCCEEDED, IDS_DIFF_SUCCEEDED, nullptr, MB_ICONINFORMATION | MB_DONT_DISPLAY_AGAIN },
// archive support
{ IDS_FAILED_EXTRACT_ARCHIVE_FILES, IDS_FAILED_EXTRACT_ARCHIVE_FILES, nullptr, MB_YESNO | MB_DONT_ASK_AGAIN | MB_ICONWARNING }
};

static std::vector<String> Answers;
Expand Down
1 change: 1 addition & 0 deletions Src/resource.h
Original file line number Diff line number Diff line change
Expand Up @@ -1221,6 +1221,7 @@
#define IDS_CONFIRM_CLOSE_WINDOW 41700
#define IDS_ERROR_EXECUTE_FILE 41719
#define IDS_UNKNOWN_ARCHIVE_FORMAT 41731
#define IDS_FAILED_EXTRACT_ARCHIVE_FILES 41732
#define IDS_COLHDR_FILENAME 41751
#define IDS_COLHDR_DIR 41752
#define IDS_COLHDR_RESULT 41753
Expand Down
76 changes: 38 additions & 38 deletions Translations/TranslationsStatus.md
Original file line number Diff line number Diff line change
@@ -1,48 +1,48 @@
# Translations Status

Status from **2022-03-17**:
Status from **2022-03-18**:

## WinMerge

| Language | Total | Translated | Fuzzy | Untranslated | Complete | Last Update |
|:---------------------|------:|-----------:|------:|-------------:|---------:|:-----------:|
| Arabic | 1202 | 898 | 0 | 304 | 74 % | 2019-12-30 |
| Basque | 1202 | 639 | 0 | 563 | 53 % | 2013-02-03 |
| Brazilian | 1202 | 1084 | 0 | 118 | 90 % | 2021-08-09 |
| Bulgarian | 1202 | 964 | 0 | 238 | 80 % | 2021-06-28 |
| Catalan | 1202 | 1188 | 0 | 14 | 98 % | |
| ChineseSimplified | 1202 | 1180 | 0 | 22 | 98 % | |
| ChineseTraditional | 1202 | 1126 | 0 | 76 | 93 % | 2022-02-19 |
| Corsican | 1202 | 1202 | 0 | 0 | 100 % | 2022-03-16 |
| Croatian | 1202 | 631 | 1 | 570 | 52 % | 2009-02-13 |
| Czech | 1202 | 606 | 0 | 596 | 50 % | |
| Danish | 1202 | 640 | 0 | 562 | 53 % | 2013-01-13 |
| Dutch | 1202 | 1198 | 0 | 4 | 99 % | 2018-09-06 |
| English | 1202 | 1202 | 0 | 0 | 100 % | 2022-03-16 |
| Finnish | 1202 | 899 | 0 | 303 | 74 % | |
| French | 1202 | 1199 | 0 | 3 | 99 % | 2022-02-26 |
| Galician | 1202 | 1134 | 0 | 68 | 94 % | 2021-12-18 |
| German | 1202 | 1199 | 0 | 3 | 99 % | 2022-03-04 |
| Greek | 1202 | 605 | 0 | 597 | 50 % | |
| Hungarian | 1202 | 1202 | 0 | 0 | 100 % | 2021-03-15 |
| Italian | 1202 | 989 | 0 | 213 | 82 % | 2021-08-09 |
| Japanese | 1202 | 1202 | 0 | 0 | 100 % | 2022-01-28 |
| Korean | 1202 | 1198 | 0 | 4 | 99 % | 2022-02-02 |
| Lithuanian | 1202 | 1157 | 0 | 45 | 96 % | 2022-03-04 |
| Norwegian | 1202 | 731 | 0 | 471 | 60 % | |
| Persian | 1202 | 642 | 0 | 560 | 53 % | 2013-08-15 |
| Polish | 1202 | 1108 | 0 | 94 | 92 % | |
| Portuguese | 1202 | 1199 | 0 | 3 | 99 % | 2022-03-03 |
| Romanian | 1202 | 561 | 44 | 597 | 50 % | |
| Russian | 1202 | 1155 | 0 | 47 | 96 % | 2022-01-27 |
| Serbian | 1202 | 633 | 0 | 569 | 52 % | |
| Sinhala | 1202 | 564 | 58 | 580 | 51 % | 2010-12-12 |
| Slovak | 1202 | 1198 | 0 | 4 | 99 % | 2022-02-17 |
| Slovenian | 1202 | 1199 | 0 | 3 | 99 % | 2022-02-21 |
| Spanish | 1202 | 868 | 0 | 334 | 72 % | 2020-04-03 |
| Swedish | 1202 | 1092 | 0 | 110 | 90 % | 2021-09-15 |
| Turkish | 1202 | 1134 | 0 | 68 | 94 % | 2021-12-21 |
| Ukrainian | 1202 | 637 | 0 | 565 | 52 % | 2009-06-13 |
| Arabic | 1203 | 898 | 0 | 305 | 74 % | 2019-12-30 |
| Basque | 1203 | 639 | 0 | 564 | 53 % | 2013-02-03 |
| Brazilian | 1203 | 1084 | 0 | 119 | 90 % | 2021-08-09 |
| Bulgarian | 1203 | 964 | 0 | 239 | 80 % | 2021-06-28 |
| Catalan | 1203 | 1188 | 0 | 15 | 98 % | |
| ChineseSimplified | 1203 | 1180 | 0 | 23 | 98 % | |
| ChineseTraditional | 1203 | 1126 | 0 | 77 | 93 % | 2022-02-19 |
| Corsican | 1203 | 1202 | 0 | 1 | 99 % | 2022-03-16 |
| Croatian | 1203 | 631 | 1 | 571 | 52 % | 2009-02-13 |
| Czech | 1203 | 606 | 0 | 597 | 50 % | |
| Danish | 1203 | 640 | 0 | 563 | 53 % | 2013-01-13 |
| Dutch | 1203 | 1198 | 0 | 5 | 99 % | 2018-09-06 |
| English | 1203 | 1203 | 0 | 0 | 100 % | 2022-03-18 |
| Finnish | 1203 | 899 | 0 | 304 | 74 % | |
| French | 1203 | 1199 | 0 | 4 | 99 % | 2022-02-26 |
| Galician | 1203 | 1134 | 0 | 69 | 94 % | 2021-12-18 |
| German | 1203 | 1199 | 0 | 4 | 99 % | 2022-03-04 |
| Greek | 1203 | 605 | 0 | 598 | 50 % | |
| Hungarian | 1203 | 1202 | 0 | 1 | 99 % | 2021-03-15 |
| Italian | 1203 | 989 | 0 | 214 | 82 % | 2021-08-09 |
| Japanese | 1203 | 1202 | 0 | 1 | 99 % | 2022-01-28 |
| Korean | 1203 | 1198 | 0 | 5 | 99 % | 2022-02-02 |
| Lithuanian | 1203 | 1157 | 0 | 46 | 96 % | 2022-03-04 |
| Norwegian | 1203 | 731 | 0 | 472 | 60 % | |
| Persian | 1203 | 642 | 0 | 561 | 53 % | 2013-08-15 |
| Polish | 1203 | 1108 | 0 | 95 | 92 % | |
| Portuguese | 1203 | 1199 | 0 | 4 | 99 % | 2022-03-03 |
| Romanian | 1203 | 561 | 44 | 598 | 50 % | |
| Russian | 1203 | 1155 | 0 | 48 | 96 % | 2022-01-27 |
| Serbian | 1203 | 633 | 0 | 570 | 52 % | |
| Sinhala | 1203 | 564 | 58 | 581 | 51 % | 2010-12-12 |
| Slovak | 1203 | 1198 | 0 | 5 | 99 % | 2022-02-17 |
| Slovenian | 1203 | 1199 | 0 | 4 | 99 % | 2022-02-21 |
| Spanish | 1203 | 868 | 0 | 335 | 72 % | 2020-04-03 |
| Swedish | 1203 | 1092 | 0 | 111 | 90 % | 2021-09-15 |
| Turkish | 1203 | 1134 | 0 | 69 | 94 % | 2021-12-21 |
| Ukrainian | 1203 | 637 | 0 | 566 | 52 % | 2009-06-13 |

## ShellExtension

Expand Down
3 changes: 3 additions & 0 deletions Translations/WinMerge/Arabic.po
Original file line number Diff line number Diff line change
Expand Up @@ -2772,6 +2772,9 @@ msgstr "فشل في تشغيل المحرر الخارجي: %1"
msgid "Unknown archive format"
msgstr "نوع أرشيف غير معروف"

msgid "Failed to extract archive files.\nDo you want to compare the archive files as text files?"
msgstr ""

msgid "Filename"
msgstr "اسم الملف"

Expand Down
3 changes: 3 additions & 0 deletions Translations/WinMerge/Basque.po
Original file line number Diff line number Diff line change
Expand Up @@ -3299,6 +3299,9 @@ msgstr "Hutsegitea kanpoko editatzailea ekiterakoan: %1"
msgid "Unknown archive format"
msgstr "Agiri heuskarri ezezaguna"

msgid "Failed to extract archive files.\nDo you want to compare the archive files as text files?"
msgstr ""

#, c-format
msgid "Filename"
msgstr "Agirizena"
Expand Down
3 changes: 3 additions & 0 deletions Translations/WinMerge/Brazilian.po
Original file line number Diff line number Diff line change
Expand Up @@ -2834,6 +2834,9 @@ msgstr "Falhou em executar o editor externo: %1"
msgid "Unknown archive format"
msgstr "Formato do arquivo desconhecido"

msgid "Failed to extract archive files.\nDo you want to compare the archive files as text files?"
msgstr ""

msgid "Filename"
msgstr "Nome do Arquivo"

Expand Down
3 changes: 3 additions & 0 deletions Translations/WinMerge/Bulgarian.po
Original file line number Diff line number Diff line change
Expand Up @@ -2815,6 +2815,9 @@ msgstr "Не може да се стартира външния редактор
msgid "Unknown archive format"
msgstr "Непознат архивен формат"

msgid "Failed to extract archive files.\nDo you want to compare the archive files as text files?"
msgstr ""

msgid "Filename"
msgstr "Име"

Expand Down
3 changes: 3 additions & 0 deletions Translations/WinMerge/Catalan.po
Original file line number Diff line number Diff line change
Expand Up @@ -3348,6 +3348,9 @@ msgstr "No s'ha pogut executar l'editor extern: %1"
msgid "Unknown archive format"
msgstr "El format de l'arxiu és desconegut"

msgid "Failed to extract archive files.\nDo you want to compare the archive files as text files?"
msgstr ""

#, c-format
msgid "Filename"
msgstr "Nom de fitxer"
Expand Down
3 changes: 3 additions & 0 deletions Translations/WinMerge/ChineseSimplified.po
Original file line number Diff line number Diff line change
Expand Up @@ -2796,6 +2796,9 @@ msgstr "外部编辑器运行失败: %1"
msgid "Unknown archive format"
msgstr "未知的压缩包格式"

msgid "Failed to extract archive files.\nDo you want to compare the archive files as text files?"
msgstr ""

msgid "Filename"
msgstr "文件名称"

Expand Down
3 changes: 3 additions & 0 deletions Translations/WinMerge/ChineseTraditional.po
Original file line number Diff line number Diff line change
Expand Up @@ -3362,6 +3362,9 @@ msgstr "無法執行外部編輯器 %1"
msgid "Unknown archive format"
msgstr "未知壓縮格式"

msgid "Failed to extract archive files.\nDo you want to compare the archive files as text files?"
msgstr ""

#, c-format
msgid "Filename"
msgstr "檔案名稱"
Expand Down
3 changes: 3 additions & 0 deletions Translations/WinMerge/Corsican.po
Original file line number Diff line number Diff line change
Expand Up @@ -2803,6 +2803,9 @@ msgstr "Impussibule di lancià l’editore esternu : %1"
msgid "Unknown archive format"
msgstr "Furmatu scunnisciutu d’archiviu"

msgid "Failed to extract archive files.\nDo you want to compare the archive files as text files?"
msgstr ""

msgid "Filename"
msgstr "Nome di schedariu"

Expand Down
3 changes: 3 additions & 0 deletions Translations/WinMerge/Croatian.po
Original file line number Diff line number Diff line change
Expand Up @@ -3297,6 +3297,9 @@ msgstr "Greška pri pokretanju vanjskog editora: %1"
msgid "Unknown archive format"
msgstr "Nepoznat oblik arhiva"

msgid "Failed to extract archive files.\nDo you want to compare the archive files as text files?"
msgstr ""

#, c-format
msgid "Filename"
msgstr "Naziv datoteke"
Expand Down
3 changes: 3 additions & 0 deletions Translations/WinMerge/Czech.po
Original file line number Diff line number Diff line change
Expand Up @@ -3244,6 +3244,9 @@ msgstr "Nelze spustit externí editor: %1"
msgid "Unknown archive format"
msgstr "Neznámý formát archivu"

msgid "Failed to extract archive files.\nDo you want to compare the archive files as text files?"
msgstr ""

#, c-format
msgid "Filename"
msgstr "Název souboru"
Expand Down
3 changes: 3 additions & 0 deletions Translations/WinMerge/Danish.po
Original file line number Diff line number Diff line change
Expand Up @@ -3317,6 +3317,9 @@ msgstr "Kunne ikke eksekvere ekstern editor: %1"
msgid "Unknown archive format"
msgstr "Ukendt arkivformat"

msgid "Failed to extract archive files.\nDo you want to compare the archive files as text files?"
msgstr ""

#, c-format
msgid "Filename"
msgstr "Filnavn"
Expand Down
3 changes: 3 additions & 0 deletions Translations/WinMerge/Dutch.po
Original file line number Diff line number Diff line change
Expand Up @@ -2819,6 +2819,9 @@ msgstr "Uitvoeren externe editor mislukt: %1"
msgid "Unknown archive format"
msgstr "Onbekend archiefformaat"

msgid "Failed to extract archive files.\nDo you want to compare the archive files as text files?"
msgstr ""

msgid "Filename"
msgstr "Bestandsnaam"

Expand Down
5 changes: 4 additions & 1 deletion Translations/WinMerge/English.pot
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WinMerge\n"
"Report-Msgid-Bugs-To: https://bugs.winmerge.org/\n"
"POT-Creation-Date: 2022-03-16 00:18+0000\n"
"POT-Creation-Date: 2022-03-18 21:36+0000\n"
"PO-Revision-Date: \n"
"Last-Translator: \n"
"Language-Team: English <winmerge-translate@lists.sourceforge.net>\n"
Expand Down Expand Up @@ -2552,6 +2552,9 @@ msgstr ""
msgid "Unknown archive format"
msgstr ""

msgid "Failed to extract archive files.\nDo you want to compare the archive files as text files?"
msgstr ""

msgid "Filename"
msgstr ""

Expand Down
3 changes: 3 additions & 0 deletions Translations/WinMerge/Finnish.po
Original file line number Diff line number Diff line change
Expand Up @@ -3319,6 +3319,9 @@ msgstr "Ulkoisen editorin ajo epäonnistui: %1"
msgid "Unknown archive format"
msgstr "Tuntematon arkistomuoto"

msgid "Failed to extract archive files.\nDo you want to compare the archive files as text files?"
msgstr ""

#, c-format
msgid "Filename"
msgstr "Tiedostonimi"
Expand Down
3 changes: 3 additions & 0 deletions Translations/WinMerge/French.po
Original file line number Diff line number Diff line change
Expand Up @@ -3363,6 +3363,9 @@ msgstr "Lancement de l'éditeur externe a échoué : %1"
msgid "Unknown archive format"
msgstr "Format d'archives inconnu"

msgid "Failed to extract archive files.\nDo you want to compare the archive files as text files?"
msgstr ""

#, c-format
msgid "Filename"
msgstr "Nom du fichier"
Expand Down
3 changes: 3 additions & 0 deletions Translations/WinMerge/Galician.po
Original file line number Diff line number Diff line change
Expand Up @@ -3355,6 +3355,9 @@ msgstr "Non se puido executar o editor externo: %1"
msgid "Unknown archive format"
msgstr "Formato de arquivo descoñecido"

msgid "Failed to extract archive files.\nDo you want to compare the archive files as text files?"
msgstr ""

#, c-format
msgid "Filename"
msgstr "Nome do arquivo"
Expand Down
3 changes: 3 additions & 0 deletions Translations/WinMerge/German.po
Original file line number Diff line number Diff line change
Expand Up @@ -3130,6 +3130,9 @@ msgstr "Konnte externen Editor nicht ausführen: %1"
msgid "Unknown archive format"
msgstr "Unbekanntes Archivformat"

msgid "Failed to extract archive files.\nDo you want to compare the archive files as text files?"
msgstr ""

#, c-format
msgid "Filename"
msgstr "Dateiname"
Expand Down
3 changes: 3 additions & 0 deletions Translations/WinMerge/Greek.po
Original file line number Diff line number Diff line change
Expand Up @@ -3275,6 +3275,9 @@ msgstr "Αποτυχία κατά το άνοιγμα άλλης εφαρμογ
msgid "Unknown archive format"
msgstr "Άγνωστη μορφή συμπιεσμένου αρχείου"

msgid "Failed to extract archive files.\nDo you want to compare the archive files as text files?"
msgstr ""

#, c-format
msgid "Filename"
msgstr "Όνομα Αρχείου"
Expand Down
3 changes: 3 additions & 0 deletions Translations/WinMerge/Hungarian.po
Original file line number Diff line number Diff line change
Expand Up @@ -3356,6 +3356,9 @@ msgstr "Nem sikerült elindítani a külső szerkesztőt: %1"
msgid "Unknown archive format"
msgstr "Ismeretlen archívum formátum"

msgid "Failed to extract archive files.\nDo you want to compare the archive files as text files?"
msgstr ""

#, c-format
msgid "Filename"
msgstr "Fájlnév"
Expand Down
3 changes: 3 additions & 0 deletions Translations/WinMerge/Italian.po
Original file line number Diff line number Diff line change
Expand Up @@ -2782,6 +2782,9 @@ msgstr "Impossibile avviare l'editor esterno: %1"
msgid "Unknown archive format"
msgstr "Formato archivio sconosciuto"

msgid "Failed to extract archive files.\nDo you want to compare the archive files as text files?"
msgstr ""

msgid "Filename"
msgstr "Nome file"

Expand Down

0 comments on commit 54ef361

Please sign in to comment.