diff options
author | Richard Maw <richard.maw@gmail.com> | 2021-08-05 19:32:27 +0100 |
---|---|---|
committer | Richard Maw <richard.maw@gmail.com> | 2021-08-05 19:32:27 +0100 |
commit | 733b523c5accece101977c8d62cb1a6d7bd606ee (patch) | |
tree | 83b2aace1adde225d9b598c12a3db2f559ab4d1e | |
parent | 1a8535a566cf6629084ceb9d208d8c645e726690 (diff) | |
download | subplot-733b523c5accece101977c8d62cb1a6d7bd606ee.tar.gz |
fix: bash files implementations inability to read
The template unpacks the embedded files into the datadir
before the scendir is created and chdir'd into.
Since dict_* assume that the files you want to read
are in the current directory this makes them unreadable.
Making them operate relative to datadir seemed
like the least complicated solution, compared to copying them in
or some kind of search path.
-rw-r--r-- | share/bash/template/files.sh | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/share/bash/template/files.sh b/share/bash/template/files.sh index 50c935d..e27bf0d 100644 --- a/share/bash/template/files.sh +++ b/share/bash/template/files.sh @@ -3,15 +3,16 @@ # Store files embedded in the markdown input. files_new() { - dict_new _files + rm -rf "$_datadir/_files" + mkdir "$_datadir/_files" } files_set() { - dict_set _files "$1" "$2" + printf "%s" "$2" >"$_datadir/_files/$1" } files_get() { - dict_get _files "$1" + cat "$_datadir/_files/$1" } |