thumbnail: create thumbnail folder and fix bad cache

This commit is contained in:
Mitchel Stewart 2025-07-08 02:03:31 -03:00 committed by Jeremy Soller
parent 3566040bac
commit e04f17b97d
2 changed files with 10 additions and 1 deletions

View file

@ -33,6 +33,13 @@ impl ThumbnailCacher {
.ok_or("failed to get thumbnail cache directory".to_string())?;
let thumbnail_filename = thumbnail_cache_filename(&file_uri);
let thumbnail_dir = cache_base_dir.join(thumbnail_size.subdirectory_name());
if !thumbnail_dir.is_dir() {
log::warn!("{:?} is not a directory, creating one now", &thumbnail_dir);
fs::create_dir_all(&thumbnail_dir).unwrap_or(log::error!(
"{:?} failed to create directory, this error can be expected on first run",
&thumbnail_dir
));
}
let thumbnail_path = thumbnail_dir.join(&thumbnail_filename);
let thumbnail_fail_marker_path = cache_base_dir
.join("fail")