Skip to content

fix: preserve last modified time#763

Open
YuevUwU wants to merge 1 commit intoTeamFlos:mainfrom
YuevUwU:preserve-last-modified-time
Open

fix: preserve last modified time#763
YuevUwU wants to merge 1 commit intoTeamFlos:mainfrom
YuevUwU:preserve-last-modified-time

Conversation

@YuevUwU
Copy link
Copy Markdown
Contributor

@YuevUwU YuevUwU commented Apr 10, 2026

Close #746
Close #761

Changes and Choice

  • files in chart will keep it.
  • zip by multi-export will all be seen as the same time as top-level zip. (the time before zipping)
  • Enable chrono feature of zip
  • Use chrono feature for zip, instead of time currently due to crate addition and complexity
    • SystemTime may have no existing method to convert to zip::DateTime
    • impl chrono::NaiveDateTime for zip::Datetime is only available if chrono feature is enabled
    • chrono feature won't set modified time as "current timestamp". That is only time feature would do.
  • Consider see also: Preserve File Modification and Creation Times During Zip/Unzip Operations zip-rs/zip2#219

NOTICE

  • chrono feature also add logic with std::fs::File::set_modified on zip::read::ZipArchive::extract (src). I'm not sure if there are some OS allows to write but deny write metadata. Currently, Phira using their custom logic (not extract), and the last modified time is still import time. It may still cause unavailablility for what we don't need in the future, so may need to remember it. (even if it's difficult to handle completely)

BTW

There is a maybe unused function about writing zip. It had used on Mivik/prpr.
I just keep it original.

pub fn update_zip<R: Read + Seek>(zip: &mut ZipArchive<R>, patches: HashMap<String, Vec<u8>>) -> Result<Vec<u8>> {

- files in chart will keep it.
- zip by multi-export will all be seen as the same time as top-level zip. (the time before zipping)
- Enable `chrono` feature of `zip`

- NOTICE: `chrono` feature also add logic with `std::fs::File::set_modified` on `zip::read::ZipArchive::extract`.
  I'm not sure if there are some OS allows to write but deny write metadata.
  Currently, Phira using their custom logic (not `extract`), and the last modified time is still import time.
  It may still cause unavailablility for what we don't need in the future, so may need to remember it. (even if it's difficult to handle completely)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

关于导出的问题 导出功能日期

1 participant