#!/usr/bin/perl -w # w32_mkcons.pl - Create a console version of the running PAR exe. # May need to be rerun if the PAR_TEMP is cleared use File::Copy; #warn `set`; warn $0; warn $^X; $ENV{PAR_PROGNAME} or die "$0 only works under PAR"; my ($exe_path, $gui_exe) = $ENV{PAR_PROGNAME} =~ m{^ (.*[\\/]) (.*)}x; (my $con_exe = $gui_exe) =~ s/\.exe$/-cons.exe/; my $gui_par = "$ENV{PAR_TEMP}/$gui_exe"; my $con_par = "$ENV{PAR_TEMP}/$con_exe"; copy("$exe_path$gui_exe" => "$exe_path$con_exe"); copy($gui_par => $con_par); my @cmd = w32_cmd('w32_exetype.pl'); # needs par_wrap.pl system(@cmd, $con_exe, 'console'); system(@cmd, $con_par, 'console'); sub w32_cmd { my $script = shift; my @cmd; # Run PAR_PROGNAME exe as the perl/parl interpreter and # let bin/par_wrap.pl run $script @cmd = ($ENV{PAR_PROGNAME}, $script); return @cmd; } __END__