diff --git a/src/tools/fullName.pl b/src/tools/fullName.pl new file mode 100755 index 000000000..e2b154f39 --- /dev/null +++ b/src/tools/fullName.pl @@ -0,0 +1,31 @@ +#!/usr/bin/perl + +use Cwd; +use File::Basename; + +sub Usage +{ + my ($txt) = @_; + + print "\nError: $txt\n" if $txt; + + exit 2; +} + +# need at least one args: ARGV[0] +Usage("need more args") if $#ARGV < 0; + +$target=$ARGV[0]; + +$basename = basename($target,""); +$dirname = dirname($target,""); +if ($dirname eq ".") { + print "$basename"; +} else { + $dir=cwd(); + chdir $dirname; + $nativename=cwd(); + chdir $dir; + $nativename="$nativename/$basename"; + print "$nativename"; +}