From e0a8c16f72d2e4380b0de5017ee4f60873c63e8d Mon Sep 17 00:00:00 2001 From: Xiaoou Zhang Date: Sun, 18 Mar 2012 23:18:46 +0800 Subject: [PATCH] Update usefultools --- tools/autopl.pl | 3 ++- tools/autopm.pl | 5 +++-- tools/gitupdate.pl | 1 - 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/tools/autopl.pl b/tools/autopl.pl index 11e37be..dd9ac5d 100755 --- a/tools/autopl.pl +++ b/tools/autopl.pl @@ -1,6 +1,7 @@ #!/usr/bin/perl use strict; use warnings; +use Cwd; # # Program Name: autopl.pl @@ -78,7 +79,7 @@ sub interactive { while (1) { # input file pathway print "Please input perl file pathway:\n"; chomp($opts{p} = ); - chomp($opts{p} = `pwd`) if $opts{p} eq ''; + $opts{p} = getcwd() if $opts{p} eq ''; if (-d $opts{p} and -w $opts{p}) { last; } diff --git a/tools/autopm.pl b/tools/autopm.pl index f6a234a..1608483 100755 --- a/tools/autopm.pl +++ b/tools/autopm.pl @@ -1,6 +1,7 @@ #!/usr/bin/perl use strict; use warnings; +use Cwd; # # Program Name: autopm.pl @@ -67,7 +68,7 @@ sub help { $opts{a} = '' unless defined $opts{a}; # if no $ENV{USER} # set and check pathway -$opts{p} =`pwd` unless exists $opts{p} and $opts{p} ne ''; +$opts{p} = getpwd() unless exists $opts{p} and $opts{p} ne ''; -d $opts{p} and -w $opts{p} or die "Your pathway is wrong or no write permission! Please check!\n"; $opts{p} =~ s/([^\/]$)/$1\//; @@ -101,7 +102,7 @@ sub interactive { while (1) { # input module pathway print "Please input module pathway:\n"; chomp($opts{p} = ); - chomp($opts{p} = `pwd`) if $opts{p} eq ''; + $opts{p} = getcwd() if $opts{p} eq ''; if (-d $opts{p} and -w $opts{p}) { last; } diff --git a/tools/gitupdate.pl b/tools/gitupdate.pl index 1b6d309..3a6fc1b 100755 --- a/tools/gitupdate.pl +++ b/tools/gitupdate.pl @@ -62,7 +62,6 @@ sub help { or die "Can't find 'git'! Please check if it's installed correctly!\n"; # run commands -my $pwd = `pwd`; chdir $opts{p} or die "Can't open $opts{p}! Please check!\n"; # git add system("git add .") == 0