@@ -53,10 +53,34 @@ [[OFFileManager defaultManager] setAttributes: attributes ofItemAtPath: path]; #endif } + +static void +setModificationDate(OFString *path, OFLHAArchiveEntry *entry) +{ + OFDate *modificationDate = entry.modificationDate; + of_file_attributes_t attributes; + + if (modificationDate == nil) { + /* + * Fall back to the original date if we have no modification + * date, as the modification date is a UNIX extension. + */ + modificationDate = entry.date; + + if (modificationDate == nil) + return; + } + + attributes = [OFDictionary + dictionaryWithObject: modificationDate + forKey: of_file_attribute_key_modification_date]; + [[OFFileManager defaultManager] setAttributes: attributes + ofItemAtPath: path]; +} @implementation LHAArchive + (void)initialize { if (self == [LHAArchive class]) @@ -283,10 +307,11 @@ if ([fileName hasSuffix: @"/"]) { [fileManager createDirectoryAtPath: outFileName createParents: true]; setPermissions(outFileName, entry); + setModificationDate(outFileName, entry); if (app->_outputLevel >= 0) { [of_stdout writeString: @"\r"]; [of_stdout writeLine: OF_LOCALIZED( @"extracting_file_done", @@ -339,10 +364,13 @@ @"file", fileName, @"percent", percentString)]; } } + [output close]; + setModificationDate(outFileName, entry); + if (app->_outputLevel >= 0) { [of_stdout writeString: @"\r"]; [of_stdout writeLine: OF_LOCALIZED( @"extracting_file_done", @"Extracting %[file]... done",