From 91b0ee7affc57d0030403ed322fa164146e5585a Mon Sep 17 00:00:00 2001 From: Benjamin Morrison Date: Sun, 24 Oct 2021 02:14:45 -0400 Subject: [PATCH] set ~/.clinte.json to 644 --- src/posts.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/posts.rs b/src/posts.rs index 1dfd167..2d486bc 100644 --- a/src/posts.rs +++ b/src/posts.rs @@ -1,7 +1,7 @@ use std::io; #[cfg(not(test))] -use std::{env, fs}; +use std::{env, fs, os::unix::fs::PermissionsExt}; use crate::conf; use crate::db; @@ -130,6 +130,8 @@ pub fn display() -> error::Result<()> { let homedir = env::var("HOME")?; let localdest = format!("{}/.clinte.json", homedir); fs::copy(db::PATH, localdest)?; + let mut perms = fs::metadata(&localdest)?.permissions(); + perms.set_mode(0o644); } Ok(())