Fix windows compilation issues
This commit is contained in:
parent
8c57060db2
commit
4afacccc8a
5 changed files with 59 additions and 22 deletions
|
|
@ -1,11 +1,12 @@
|
|||
use image::DynamicImage;
|
||||
use md5::{Digest, Md5};
|
||||
use rustc_hash::FxHashMap;
|
||||
#[cfg(unix)]
|
||||
use std::os::unix::fs::PermissionsExt;
|
||||
use std::{
|
||||
error::Error,
|
||||
fs::{self, File},
|
||||
io::{self, BufReader, BufWriter},
|
||||
os::unix::fs::PermissionsExt,
|
||||
path::{Path, PathBuf},
|
||||
sync::LazyLock,
|
||||
time::UNIX_EPOCH,
|
||||
|
|
@ -93,6 +94,7 @@ impl ThumbnailCacher {
|
|||
}
|
||||
|
||||
pub fn update_with_temp_file(&self, temp_file: NamedTempFile) -> Result<&Path, Box<dyn Error>> {
|
||||
#[cfg(unix)]
|
||||
fs::set_permissions(temp_file.path(), fs::Permissions::from_mode(0o600))?;
|
||||
self.update_thumbnail_text_metadata(temp_file.path())?;
|
||||
fs::rename(temp_file.path(), &self.thumbnail_path)?;
|
||||
|
|
@ -127,6 +129,7 @@ impl ThumbnailCacher {
|
|||
pub fn create_fail_marker(&self) -> Result<(), Box<dyn Error>> {
|
||||
if let Some(dir) = self.thumbnail_fail_marker_path.parent() {
|
||||
fs::create_dir_all(dir)?;
|
||||
#[cfg(unix)]
|
||||
fs::set_permissions(dir, fs::Permissions::from_mode(0o700))?;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue