@@ -965,7 +965,11 @@ impl Document {
965 // Allows setting the flag for files the user cannot modify, like root files
965 // Allows setting the flag for files the user cannot modify, like root files
966 self.readonly = match &self.path {
966 self.readonly = match &self.path {
967 None => false,
967 None => false,
968− Some(p) => access(p, Access::WRITE_OK).is_err(),
968+ Some(p) => match access(p, Access::WRITE_OK) {
970+ Err(err) if err.kind() == std::io::ErrorKind::NotFound => false,
@@ -979,6 +983,7 @@ impl Document {
979 self.readonly = match &self.path {
983 self.readonly = match &self.path {
980 None => false,
984 None => false,
981 Some(p) => match std::fs::metadata(p) {
985 Some(p) => match std::fs::metadata(p) {
986+ Err(err) if err.kind() == std::io::ErrorKind::NotFound => false,
982 Err(_) => false,
987 Err(_) => false,
983 Ok(metadata) => metadata.permissions().readonly(),
988 Ok(metadata) => metadata.permissions().readonly(),