@@ -720,6 +720,8 @@ class ItemsAdapter(
720720 paths.forEach { path ->
721721 val zipInputStream =
722722 ZipInputStream (BufferedInputStream (activity.getFileInputStreamSync(path)))
723+
724+ val foldersTimestamp = mutableListOf<Pair <File , LocalFileHeader >>()
723725 zipInputStream.use {
724726 try {
725727 var entry = zipInputStream.nextEntry
@@ -740,26 +742,29 @@ class ItemsAdapter(
740742 if (activity.getIsPathDirectory(path)) {
741743 activity.deleteFolderBg(fileDirItem, false ) {
742744 if (it) {
743- extractEntry(newPath, entry, zipInputStream)
745+ extractEntry(newPath, entry, zipInputStream, foldersTimestamp )
744746 } else {
745747 callback(false )
746748 }
747749 }
748750 } else {
749751 activity.deleteFileBg(fileDirItem, false , false ) {
750752 if (it) {
751- extractEntry(newPath, entry, zipInputStream)
753+ extractEntry(newPath, entry, zipInputStream, foldersTimestamp )
752754 } else {
753755 callback(false )
754756 }
755757 }
756758 }
757759 } else if (! doesPathExist) {
758- extractEntry(newPath, entry, zipInputStream)
760+ extractEntry(newPath, entry, zipInputStream, foldersTimestamp )
759761 }
760762
761763 entry = zipInputStream.nextEntry
762764 }
765+ for ((dir, header) in foldersTimestamp.asReversed()) {
766+ dir.setLastModified(header)
767+ }
763768 callback(true )
764769 } catch (e: Exception ) {
765770 activity.showErrorToast(e)
@@ -772,13 +777,16 @@ class ItemsAdapter(
772777 private fun extractEntry (
773778 newPath : String ,
774779 entry : LocalFileHeader ,
775- zipInputStream : ZipInputStream
780+ zipInputStream : ZipInputStream ,
781+ foldersTimestamp : MutableList <Pair <File , LocalFileHeader >>
776782 ) {
777783 if (entry.isDirectory) {
778784 if (! activity.createDirectorySync(newPath) && ! activity.getDoesFilePathExist(newPath)) {
779785 val error =
780786 String .format(activity.getString(R .string.could_not_create_file), newPath)
781787 activity.showErrorToast(error)
788+ } else {
789+ foldersTimestamp.add(Pair (File (newPath), entry))
782790 }
783791 } else {
784792 val fos = activity.getFileOutputStreamSync(newPath, newPath.getMimeType())
0 commit comments