use warnings;
use File::Slurp;
+use FindBin;
use List::Util qw(first max);
use Template;
-my $rel_dir = (first { -f "${_}/SL/ClientJS.pm" } qw(. ..)) || die "ClientJS.pm not found";
+my $rel_dir = $FindBin::Bin . '/..';
my @actions;
foreach (read_file("${rel_dir}/SL/ClientJS.pm")) {
$output .= sprintf "\n else\%sconsole.log('Unknown action: ' + action[0]);\n", ' ' x (4 + 2 + 6 + 3 + 4 + 2 + $longest + 1);
-my $template = Template->new({ RELATIVE => 1 });
+my $template = Template->new({ ABSOLUTE => 1 });
$template->process($rel_dir . '/scripts/generate_client_js_actions.tpl', { actions => $output }, $rel_dir . '/js/client_js.js') || die $template->error(), "\n";
print "js/client_js.js generated automatically.\n";