Move temp file to utils
This commit is contained in:
parent
fef80299ca
commit
9290eed656
2 changed files with 7 additions and 7 deletions
|
@ -1,7 +1,6 @@
|
|||
use zip::ZipArchive;
|
||||
use mktemp::Temp;
|
||||
use std::path::PathBuf;
|
||||
use utils::{get_exe_dir, result_override};
|
||||
use utils::{get_exe_dir, result_override, get_temp_file};
|
||||
use std::fs::File;
|
||||
use std::io::{Read, Write};
|
||||
use config::consts::CSL_FILE_NAME;
|
||||
|
@ -11,11 +10,6 @@ fn get_csl_path() -> PathBuf {
|
|||
}
|
||||
|
||||
|
||||
fn get_temp_file() -> PathBuf {
|
||||
return Temp::new_file().expect("Failed to create temporary file").to_path_buf();
|
||||
}
|
||||
|
||||
|
||||
fn get_csl_data(csl_name: String) -> Result<String, String> {
|
||||
let zip_file =
|
||||
try!(result_override(File::open(get_csl_path()), "Failed to read CSL zip".into()));
|
||||
|
|
|
@ -3,6 +3,8 @@ use std::process::exit;
|
|||
use std::io::{self, Write};
|
||||
use std::env::{current_exe, current_dir};
|
||||
use std::path::PathBuf;
|
||||
use mktemp::Temp;
|
||||
|
||||
|
||||
|
||||
#[inline]
|
||||
|
@ -45,3 +47,7 @@ pub fn resolve_path(path: String) -> PathBuf {
|
|||
let base_dir = current_dir().unwrap();
|
||||
return base_dir.join(path);
|
||||
}
|
||||
|
||||
pub fn get_temp_file() -> PathBuf {
|
||||
return Temp::new_file().expect("Failed to create temporary file").to_path_buf();
|
||||
}
|
||||
|
|
Reference in a new issue