mirror of https://github.com/lapce/lapce.git
Merge pull request #564 from panekj/fix-perms
fix: don't overwrite permissions
This commit is contained in:
commit
3d7bec2ab3
|
@ -65,6 +65,8 @@ pub fn save(&mut self, rev: u64) -> Result<()> {
|
||||||
for chunk in self.rope.iter_chunks(..self.rope.len()) {
|
for chunk in self.rope.iter_chunks(..self.rope.len()) {
|
||||||
f.write_all(chunk.as_bytes())?;
|
f.write_all(chunk.as_bytes())?;
|
||||||
}
|
}
|
||||||
|
let perm = fs::metadata(&self.path)?.permissions();
|
||||||
|
fs::set_permissions(tmp_path, perm)?;
|
||||||
fs::rename(tmp_path, &self.path)?;
|
fs::rename(tmp_path, &self.path)?;
|
||||||
self.mod_time = get_mod_time(&self.path);
|
self.mod_time = get_mod_time(&self.path);
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|
Loading…
Reference in New Issue