summaryrefslogtreecommitdiff
path: root/subplot
diff options
context:
space:
mode:
authorAlexander Batischev <eual.jp@gmail.com>2021-04-21 00:38:29 +0300
committerAlexander Batischev <eual.jp@gmail.com>2021-04-21 02:05:55 +0300
commit9c3893cf616279e4101b1ccf52d0a82b7a334b3b (patch)
treeb8ff5b6438252a5c08ae00c796625a00ae453643 /subplot
parent645392adb2c12649fc72164422fecb15993046e8 (diff)
downloadobnam2-9c3893cf616279e4101b1ccf52d0a82b7a334b3b.tar.gz
feat: add support for CACHEDIR.TAG
Fixes #78.
Diffstat (limited to 'subplot')
-rw-r--r--subplot/data.py7
-rw-r--r--subplot/data.yaml3
2 files changed, 10 insertions, 0 deletions
diff --git a/subplot/data.py b/subplot/data.py
index 3833f2e..d134e5f 100644
--- a/subplot/data.py
+++ b/subplot/data.py
@@ -29,6 +29,13 @@ def create_fifo(ctx, filename=None):
os.mkfifo(filename)
+def create_cachedir_tag_in(ctx, dirpath=None):
+ filepath = f"{dirpath}/CACHEDIR.TAG"
+ logging.debug(f"creating {filepath}")
+ os.makedirs(dirpath, exist_ok=True)
+ open(filepath, "w").write("Signature: 8a477f597d28d172789f06886806bc55")
+
+
def create_nonutf8_filename(ctx, dirname=None):
filename = "\x88"
os.mkdir(dirname)
diff --git a/subplot/data.yaml b/subplot/data.yaml
index 699c5b1..dcc6807 100644
--- a/subplot/data.yaml
+++ b/subplot/data.yaml
@@ -10,6 +10,9 @@
- given: "a named pipe {filename}"
function: create_fifo
+- given: a cache directory tag in {dirpath}
+ function: create_cachedir_tag_in
+
- given: "a file in {dirname} with a non-UTF8 filename"
function: create_nonutf8_filename