Index: trunk/ippScripts/scripts/phase2.pl
===================================================================
--- trunk/ippScripts/scripts/phase2.pl	(revision 11297)
+++ trunk/ippScripts/scripts/phase2.pl	(revision 11298)
@@ -22,6 +22,6 @@
     $input,			# Input FITS file
     $camera,			# Camera
-    $outpath,			# Outpath
     $dbname,			# Database name
+    $workdir,			# Working directory, for output files
     $no_update			# Don't update the database?
     );
@@ -31,6 +31,6 @@
     'uri|u=s'       => \$input,
     'camera|c=s'    => \$camera,
-    'outpath|o=s'   => \$outpath,
     'dbname|d=s'    => \$dbname, # Database name
+    'workdir|w=s'   => \$workdir,
     'no-update'     => \$no_update
 ) or pod2usage( 2 );
@@ -43,5 +43,4 @@
     and defined $classId 
     and defined $input
-    and defined $outpath
     and defined $camera;
 
@@ -54,10 +53,12 @@
 die "Can't find required tools.\n" if $missing_tools;
 
-# XXX old verion Output file name
-# XXX old version (drop) : my ($vol, $dir, $file) = File::Spec->splitpath( $input );
+unless (defined $workdir) {
+    my ($vol, $dir, $file) = File::Spec->splitpath( $input );
+    $workdir = $dir;
+}
 
 ### Output file name --- must match camera configuration!
 my $outputRoot =  $expTag . '.p2';
-$outputRoot = File::Spec->catpath( $outpath, $outputRoot );
+$outputRoot = File::Spec->catfile( $workdir, $outputRoot );
 $outputRoot = $ipprc->convert_filename_absolute($outputRoot);
 $input = $ipprc->convert_filename_absolute ( $input );
