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/.
This commit is contained in:
Orestis Floros 2017-09-27 15:23:32 +03:00
parent 999bebc692
commit 828ce9c640
1 changed files with 3 additions and 1 deletions

View File

@ -13,6 +13,7 @@ use warnings;
use Data::Dumper; use Data::Dumper;
use AnyEvent::I3; use AnyEvent::I3;
use File::Temp; use File::Temp;
use File::Basename;
use v5.10; use v5.10;
my $i3 = i3(); my $i3 = i3();
@ -75,4 +76,5 @@ say $tmp "draw(n" . $root->{id} . ", (0, 0));";
close($tmp); close($tmp);
my $rep = "$tmp"; my $rep = "$tmp";
$rep =~ s/asy$/eps/; $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");