diff --git a/src/build/csl.rs b/src/build/csl.rs index 6634b88..6ca99ce 100644 --- a/src/build/csl.rs +++ b/src/build/csl.rs @@ -4,6 +4,11 @@ use std::path::PathBuf; use utils::get_exe_dir; use std::fs::File; use std::io::{Read, Write}; +use config::consts::CSL_FILE_NAME; + +pub fn get_csl_path() -> PathBuf { + return get_exe_dir().join(CSL_FILE_NAME); +} fn get_temp_file() -> PathBuf { @@ -12,7 +17,7 @@ fn get_temp_file() -> PathBuf { pub fn unpack_csl(csl_name: String) -> PathBuf { let file = get_temp_file(); - let zip_file = File::open(get_exe_dir().join("csl.zip")).expect("Failed to read CSL zip"); + let zip_file = File::open(get_csl_path()).expect("Failed to read CSL zip"); let mut archive = ZipArchive::new(zip_file).expect("Failed to load zip file"); debug_assert!(archive.len() >= 10); let mut csl_zip_file = archive.by_name(&format!("{}.csl", csl_name)).expect(&format!( diff --git a/src/config/consts.rs b/src/config/consts.rs index 31bd2b7..73b4d56 100644 --- a/src/config/consts.rs +++ b/src/config/consts.rs @@ -1 +1,2 @@ -pub const CONFIG_FILE: &str = "mdp.yml"; +pub const CONFIG_FILE_NAME: &str = "mdp.yml"; +pub const CSL_FILE_NAME: &str = "csl.zip"; diff --git a/src/config/read.rs b/src/config/read.rs index 1166742..80b8834 100644 --- a/src/config/read.rs +++ b/src/config/read.rs @@ -10,7 +10,7 @@ use utils::result_override; fn get_config_path() -> PathBuf { let mut working_dir = current_dir().unwrap(); - working_dir.push(consts::CONFIG_FILE); + working_dir.push(consts::CONFIG_FILE_NAME); return working_dir; }