From 5de45cb2476e4942c986d9279b9adad60e8e7d75 Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Mallo Date: Wed, 21 Apr 2021 17:42:40 +0200 Subject: [PATCH] rplot: patch generated PDFs to use hyphen The ISOLatin1 encoding uses /minus as char 45, while the (-) symbol used in the paths is a /hyphen. This hack allows the paths in the generated PDFs to be copied directly into a terminal. --- garlic/pp/rplot.nix | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/garlic/pp/rplot.nix b/garlic/pp/rplot.nix index faaef53..cf194b6 100644 --- a/garlic/pp/rplot.nix +++ b/garlic/pp/rplot.nix @@ -149,6 +149,11 @@ in stdenv.mkDerivation { ln -s $dataset input Rscript --vanilla ${script} ${dataset} "$out" + # HACK: replace the \minus for a \hyphen to keep the file paths intact, so + # they can be copied to the terminal directly. The StandardEncoding is not + # working (AdobeStd.enc). + find "$out" -name '*.pdf' | xargs -l1 sed -i 's.45/minus.45/hyphen.g' + if [ "''${dataset##*.}" == gz ]; then gunzip --stdout $dataset else