summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Golubev <fatzer2@gmail.com>2026-02-20 17:59:33 +0300
committerAlexander Golubev <fatzer2@gmail.com>2026-02-21 04:57:07 +0300
commit1ddc8e16d8bfa6c24af40ed4b7d41a5fdda95a50 (patch)
tree7b7e268f88200cc4a2edde14b3094cfa5659ac7f
parent14d84907a09f1216dc067721b806434787291e4c (diff)
downloadtdeutils-1ddc8e16d8bfa6c24af40ed4b7d41a5fdda95a50.tar.gz
tdeutils-1ddc8e16d8bfa6c24af40ed4b7d41a5fdda95a50.zip
ark: restore unzip-5 supportHEADmaster
See-also: https://mirror.git.trinitydesktop.org/gitea/TDE/tdeutils/pulls/117#issuecomment-82676 Signed-off-by: Alexander Golubev <fatzer2@gmail.com>
-rw-r--r--ark/zip.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/ark/zip.cpp b/ark/zip.cpp
index b95c7d5..345f772 100644
--- a/ark/zip.cpp
+++ b/ark/zip.cpp
@@ -40,6 +40,7 @@
// ark includes
#include "zip.h"
+#include "arkutils.h"
#include "arkwidget.h"
#include "settings.h"
#include "filelistview.h"
@@ -324,22 +325,23 @@ bool ZipArch::processLine( const TQCString &line )
return false;
}
- // unzip-6 can be configured at build time to return date in either of three
- // formats:
+ // unzip can be configured at build time to return date in either of three
+ // formats (for version 6):
// - MM-DD-YYYY (the default on *nix systems)
// - DD-MM-YYYY (not used by default)
// - YYYY-MM-DD (used in several linux distribution e.g. debian)
// Unfortunately there is no easy way to query unzip which format it does
// use, so we will have to guestimate here. Also since the DMY is not widely
// used and in general case indistinguishable from MDY we will ignore it and
- // concentrate on distinguishing between MDY and YMD. Luckily unzip-6 unlike
- // unzip-5 uses 4 digits for years, so it will be relatively painless.
+ // concentrate on distinguishing between MDY and YMD. Luckily unzip-6 uses
+ // 4 digits for years, so it will be relatively painless. On the other hand
+ // unzip-5 uses 2-digits for a year, so in that case always assume MDY.
TQString date = lineRx.cap(5);
TQString time = lineRx.cap(6);
- TQRegExp mdyDateRx{"^([01][0-9])-([0-3][0-9])-([0-9]{4,})$"};
+ TQRegExp mdyDateRx{"^([01][0-9])-([0-3][0-9])-([0-9]{2,})$"};
if(mdyDateRx.search(date) != -1) {
- date = mdyDateRx.cap(3) + "-" + mdyDateRx.cap(1) + "-" + mdyDateRx.cap(2);
+ date = ArkUtils::fixYear(mdyDateRx.cap(3)) + "-" + mdyDateRx.cap(1) + "-" + mdyDateRx.cap(2);
}
TQString timestamp = date + " " + time;