From 8e76ff1cba4724378d51d059e3fbe913fbe1bdc9 Mon Sep 17 00:00:00 2001 From: Steve Hancock Date: Sun, 4 Dec 2022 13:38:39 -0800 Subject: [PATCH] automate location of git home --- dev-bin/get_perltidy.pl | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/dev-bin/get_perltidy.pl b/dev-bin/get_perltidy.pl index 3810b521..982a5f00 100755 --- a/dev-bin/get_perltidy.pl +++ b/dev-bin/get_perltidy.pl @@ -4,8 +4,19 @@ use warnings; use Getopt::Long; #--------------------------------------------------------- -# Define the git home of perltidy on this computer: -my $PERLTIDY_GIT = '/home/steve/src/perldev/perltidy/git'; +# Try to find the git home of perltidy on this computer. +# Assuming that this program is git/dev_bin/get_perltidy.pl, +# or a symlink to that, then we can get its path: +use Cwd qw(abs_path); +my $absolute_path = abs_path( readlink $0 ); +print "path is $absolute_path\n"; +use File::Basename; +my ( $name, $path, $suffix ) = fileparse($absolute_path); +my $PERLTIDY_GIT = $path . "../"; + +# If this doesn't work, then replace the above with a specific +# definition here: +# my $PERLTIDY_GIT = '/home/.../git #--------------------------------------------------------- @@ -14,7 +25,7 @@ if ( !-e $pm2pl ) { die <