diff options
| author | Shadowghost <Ghost_of_Stone@web.de> | 2026-05-04 21:26:26 +0200 |
|---|---|---|
| committer | Shadowghost <Ghost_of_Stone@web.de> | 2026-05-04 21:26:26 +0200 |
| commit | 57c0fcd674c659c658369f0aebfd5d9d6787a9d4 (patch) | |
| tree | 7aff23d6f54e913a6a34cb5a2568a07298582444 /Emby.Server.Implementations/AppBase/BaseApplicationPaths.cs | |
| parent | 68ab58589444091925c15ad20d36f935b7bc2e21 (diff) | |
| parent | ec04313317bed62728b059108cd232e9744f6354 (diff) | |
Merge remote-tracking branch 'upstream/master' into epg-fixes
Diffstat (limited to 'Emby.Server.Implementations/AppBase/BaseApplicationPaths.cs')
| -rw-r--r-- | Emby.Server.Implementations/AppBase/BaseApplicationPaths.cs | 21 |
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); |
