fixed permission for the reveal install script
This commit is contained in:
@@ -1,14 +1,14 @@
|
|||||||
use std::{fs::File, io::Write};
|
use std::{fs::{File, Permissions}, io::Write, os::unix::prelude::PermissionsExt};
|
||||||
|
|
||||||
use crate::app::fs_util;
|
use crate::app::fs_util;
|
||||||
|
|
||||||
const ASCIIDOC_REVEAL_VERSION: &str= "v4.1.0-rc.5";
|
const ASCIIDOC_REVEAL_VERSION: &str= "v4.1.0-rc.5";
|
||||||
|
|
||||||
pub async fn install_reveal() -> () {
|
pub async fn install_reveal() -> () {
|
||||||
let result = reqwest::blocking::get(url())
|
let result = reqwest::get(url()).await
|
||||||
.expect("Could not download reveal. Make sure you are connected to the internet");
|
.expect("Could not download reveal. Make sure you are connected to the internet");
|
||||||
|
|
||||||
let binary = result.bytes().expect("could not get binary");
|
let binary = result.bytes().await.expect("could not get binary");
|
||||||
|
|
||||||
let home_path = home::home_dir().expect("could not find home dir");
|
let home_path = home::home_dir().expect("could not find home dir");
|
||||||
let save_path = format!("{}/.docki/asciidoctor-revealjs", home_path.display());
|
let save_path = format!("{}/.docki/asciidoctor-revealjs", home_path.display());
|
||||||
@@ -17,6 +17,7 @@ pub async fn install_reveal() -> () {
|
|||||||
fs_util::create_dir_recursive(save_dir.as_str());
|
fs_util::create_dir_recursive(save_dir.as_str());
|
||||||
|
|
||||||
let mut file = File::create(save_path).expect("could not save binary");
|
let mut file = File::create(save_path).expect("could not save binary");
|
||||||
|
file.set_permissions(Permissions::from_mode(0o770)).expect("could not set permission");
|
||||||
file.write_all(&binary).expect("could not save binary");
|
file.write_all(&binary).expect("could not save binary");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user