aboutsummaryrefslogtreecommitdiff
path: root/Emby.Server.Implementations/AppBase/BaseApplicationPaths.cs
diff options
context:
space:
mode:
authorBond-009 <bond.009@outlook.com>2026-05-06 20:49:19 +0200
committerGitHub <noreply@github.com>2026-05-06 20:49:19 +0200
commit33ed52b8ee25e1fae4763a26337b838dc9782b26 (patch)
treeee68da202f604eef267254ea8c689965098b1c3e /Emby.Server.Implementations/AppBase/BaseApplicationPaths.cs
parentaa96ff42e616ecf5638a8f1e2e8459b94513c528 (diff)
parentd1ab428476f961426841a0561036c59c3b93878e (diff)
Merge branch 'master' into feature/season-provider-id-from-path
Diffstat (limited to 'Emby.Server.Implementations/AppBase/BaseApplicationPaths.cs')
-rw-r--r--Emby.Server.Implementations/AppBase/BaseApplicationPaths.cs21
1 files changed, 21 insertions, 0 deletions
diff --git a/Emby.Server.Implementations/AppBase/BaseApplicationPaths.cs b/Emby.Server.Implementations/AppBase/BaseApplicationPaths.cs
index de722332a4..56d977bbcb 100644
--- a/Emby.Server.Implementations/AppBase/BaseApplicationPaths.cs
+++ b/Emby.Server.Implementations/AppBase/BaseApplicationPaths.cs
@@ -90,6 +90,7 @@ namespace Emby.Server.Implementations.AppBase
CreateAndCheckMarker(ProgramDataPath, "data");
CreateAndCheckMarker(CachePath, "cache");
CreateAndCheckMarker(DataPath, "data");
+ CreateCacheDirTag(CachePath);
}
/// <inheritdoc />
@@ -100,6 +101,26 @@ namespace Emby.Server.Implementations.AppBase
CheckOrCreateMarker(path, $".jellyfin-{markerName}", recursive);
}
+ /// <summary>
+ /// Creates a CACHEDIR.TAG file in the specified directory per the Cache Directory Tagging specification.
+ /// This signals to backup tools (e.g. Restic, Borg) that the directory contains cached data
+ /// and can be excluded from backups.
+ /// </summary>
+ /// <param name="path">The cache directory path.</param>
+ internal static void CreateCacheDirTag(string path)
+ {
+ var tagPath = Path.Combine(path, "CACHEDIR.TAG");
+ if (!File.Exists(tagPath))
+ {
+ File.WriteAllText(
+ tagPath,
+ "Signature: 8a477f597d28d172789f06886806bc55\n"
+ + "# This file is a cache directory tag created by Jellyfin.\n"
+ + "# For information about cache directory tags, see:\n"
+ + "#\thttps://bford.info/cachedir/\n");
+ }
+ }
+
private IEnumerable<string> GetMarkers(string path, bool recursive = false)
{
return Directory.EnumerateFiles(path, ".jellyfin-*", recursive ? SearchOption.AllDirectories : SearchOption.TopDirectoryOnly);