From 00cfe03530e6a7affa96c82c3b4b63f936308a5e Mon Sep 17 00:00:00 2001 From: Tobias Hunger Date: Fri, 9 Feb 2024 01:10:27 +0100 Subject: [PATCH] moss: Add a CACHEDIR.TAG to `.moss/cache` --- crates/moss/src/installation.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/crates/moss/src/installation.rs b/crates/moss/src/installation.rs index f5373d192..f9666b2a2 100644 --- a/crates/moss/src/installation.rs +++ b/crates/moss/src/installation.rs @@ -188,4 +188,15 @@ fn ensure_dirs_exist(root: &Path) { ] { let _ = fs::create_dir_all(path); } + ensure_cachedir_tag(&moss.join("cache")); +} + +fn ensure_cachedir_tag(path: &Path) { + let cachedir_tag = path.join("CACHEDIR.TAG"); + if !cachedir_tag.exists() { + let _ = std::fs::write(cachedir_tag, + br#"Signature: 8a477f597d28d172789f06886806bc55 +# This file is a cache directory tag created by moss. +# For information about cache directory tags see https://bford.info/cachedir/"#); + } }