# HG changeset patch # User dave.jones # Date 1265808610 0 # Node ID fb679efeb2dd965ff01bed0f81dfaf200bfdf277 # Parent fed3f1d2c557bc40135dcae67319b306559901b4 Improve the parsing of the script location to determine the location of .txt files using File::Basename. Should be platform safe as $program_path will include trailing path separator. diff -r fed3f1d2c557 -r fb679efeb2dd clone_packages/clone_all_packages.pl --- a/clone_packages/clone_all_packages.pl Wed Feb 10 13:22:03 2010 +0000 +++ b/clone_packages/clone_all_packages.pl Wed Feb 10 13:30:10 2010 +0000 @@ -16,6 +16,7 @@ use strict; use Getopt::Long; +use File::Basename; sub Usage($) { @@ -93,8 +94,6 @@ my $filter = ""; my @packagelist_files = (); -my $program_path = $0; - # Analyse the rest of command-line parameters if (!GetOptions( "u|username=s" => \$username, @@ -274,10 +273,15 @@ # Read the package list files alongside the script itself # Extract the path location of the program and locate package list files - $program_path =~ s/\\/\//g; - $program_path =~ s/(^.*\/)[^\/]+$/$1/; + my ($program_name,$program_path) = &File::Basename::fileparse($0); + foreach my $file ("sf_mcl_packages.txt", "sftools_mcl_packages.txt", "other_packages.txt") { + if (! -e $program_path.$file) + { + print "Cannot find implied packagelist $program_path$file\n"; + next; + } push @packagelist_files, $program_path.$file; } $add_implied_FCL_repos = 1; # lists only contain the MCL repo locations