From afb8b916bb3647293b8b5edef9d292f971f5b23e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20Kusalananda=20K=C3=A4h=C3=A4ri?= <ak4@sanger.ac.uk> Date: Tue, 13 Mar 2007 13:54:39 +0000 Subject: [PATCH] Use cwd() from the Cwd module instead of $ENV{PWD}. Use -d instead of -e to test for directories. --- misc-scripts/xref_mapping/XrefMapper/db.pm | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/misc-scripts/xref_mapping/XrefMapper/db.pm b/misc-scripts/xref_mapping/XrefMapper/db.pm index 443f1519c3..4647b3e9c7 100644 --- a/misc-scripts/xref_mapping/XrefMapper/db.pm +++ b/misc-scripts/xref_mapping/XrefMapper/db.pm @@ -2,6 +2,7 @@ package XrefMapper::db; use vars '@ISA'; use Bio::EnsEMBL::DBSQL::DBConnection; +use Cwd; sub new{ my($class, @args) = @_; @@ -101,17 +102,17 @@ sub process_dir { my ($dir) = @_; if($dir =~ "^\/" ) { # if it start with / then its not from pwd - if(! -e $dir){ + if(! -d $dir){ die "directory does not exist $dir\n"; } } elsif($dir eq "."){ - $dir = $ENV{PWD}; + $dir = cwd(); } elsif($dir =~ "^\.\/"){ my $tmp = $dir; - $dir = $ENV{PWD}."/".substr($tmp,2); - if(! -e $dir){ + $dir = cwd() . "/" . substr( $tmp, 2 ); + if(! -d $dir){ die "directory does not exist $dir\n"; } } -- GitLab