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.
This commit is contained in:
Rodrigo Arias 2021-04-21 17:42:40 +02:00
parent 92cd88e365
commit 5de45cb247

View File

@ -149,6 +149,11 @@ in stdenv.mkDerivation {
ln -s $dataset input ln -s $dataset input
Rscript --vanilla ${script} ${dataset} "$out" 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 if [ "''${dataset##*.}" == gz ]; then
gunzip --stdout $dataset gunzip --stdout $dataset
else else