From: Orestis Floros Date: Wed, 27 Sep 2017 12:23:32 +0000 (+0300) Subject: dump-asy.pl: use correct tmp dirname instead of hardcoded /tmp X-Git-Tag: 4.15~62^2 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=828ce9c6400f3dddb6189bec6da7f2fd173af10b;p=i3%2Fi3 dump-asy.pl: use correct tmp dirname instead of hardcoded /tmp For example, on some systems, $rep might be saved in /tmp/$USER/ instead of /tmp/. --- diff --git a/contrib/dump-asy.pl b/contrib/dump-asy.pl index 3ebdb858..478a896a 100755 --- a/contrib/dump-asy.pl +++ b/contrib/dump-asy.pl @@ -13,6 +13,7 @@ use warnings; use Data::Dumper; use AnyEvent::I3; use File::Temp; +use File::Basename; use v5.10; my $i3 = i3(); @@ -75,4 +76,5 @@ say $tmp "draw(n" . $root->{id} . ", (0, 0));"; close($tmp); my $rep = "$tmp"; $rep =~ s/asy$/eps/; -system("cd /tmp && asy $tmp && gv --scale=-1000 --noresize --widgetless $rep && rm $rep"); +my $tmp_dir = dirname($rep); +system("cd $tmp_dir && asy $tmp && gv --scale=-1000 --noresize --widgetless $rep && rm $rep");