From 04b5c0e7817cbb74ca9235b994d1e05c46a9ba61 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Wed, 8 Oct 2014 07:16:00 +0200 Subject: [PATCH] Add CACHEDIR.TAG to cache. Closes #19. --- qutebrowser/utils/standarddir.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/qutebrowser/utils/standarddir.py b/qutebrowser/utils/standarddir.py index 2b1d49f8d..8c2d3d495 100644 --- a/qutebrowser/utils/standarddir.py +++ b/qutebrowser/utils/standarddir.py @@ -121,3 +121,12 @@ def init(): for path in (config_dir, data_dir, cache_dir): if path is not None and not os.path.exists(path): os.makedirs(path, 0o700) + # http://www.brynosaurus.com/cachedir/spec.html + cachedir_tag = os.path.join(cache_dir, 'CACHEDIR.TAG') + if not os.path.exists(cachedir_tag): + with open(cachedir_tag, 'w', encoding='utf-8') as f: + f.write("Signature: 8a477f597d28d172789f06886806bc55\n") + f.write("# This file is a cache directory tag created by " + "qutebrowser.\n") + f.write("# For information about cache directory tags, see:\n") + f.write("# http://www.brynosaurus.com/cachedir/\n")