Capture editor file dates and make desktop ZIP import observable
This commit is contained in:
1 parent
0ea71d57a9
commit
fbc339f5c4
11 files changed
+231
-72
No files matched your search
@@ -1,6 +1,6 @@
|
||||
use std::{
|
||||
collections::{BTreeMap, BTreeSet},
|
||||
fs, io,
|
||||
fs, io::{self, Write},
|
||||
path::{Path, PathBuf},
|
||||
};
|
||||
use texrra_engine::native::ProjectSnapshot;
|
||||
@@ -44,7 +44,14 @@ pub(super) fn save(
|
||||
.copied()
|
||||
.or_else(|| project.file(path).map(|file| file.data.as_ref()))
|
||||
{
|
||||
fs::write(&saved, data)?;
|
||||
let mut file = fs::File::create(&saved)?;
|
||||
file.write_all(data)?;
|
||||
if let Some(date) = project.modification_time(path) {
|
||||
let modified = date.to_system_time().ok_or_else(|| {
|
||||
io::Error::new(io::ErrorKind::InvalidData, "Project file date is out of range")
|
||||
})?;
|
||||
file.set_times(fs::FileTimes::new().set_modified(modified))?;
|
||||
}
|
||||
}
|
||||
if path != entry {
|
||||
files.push(name);
|
||||
|
||||
Reference in new issue
Block a user