Index: trunk/ippScripts/scripts/ipp_serial_warp.pl
===================================================================
--- trunk/ippScripts/scripts/ipp_serial_warp.pl	(revision 16336)
+++ trunk/ippScripts/scripts/ipp_serial_warp.pl	(revision 16746)
@@ -27,4 +27,5 @@
 my ($dbname,			# Database name to use
     $verbose,			# Verbose operations?
+    $workdir_global,		# Global working directory
     $no_op,			# No operations?
     $no_update,			# No updating?
@@ -33,4 +34,5 @@
 	   'dbname=s' => \$dbname,
 	   'verbose' => \$verbose,
+	   'workdir' => \$workdir_global,
 	   'no-op' => \$no_op,
 	   'no-update' => \$no_update,
@@ -82,5 +84,4 @@
 	$command .= " --no-op" if defined $no_op;
 	$command .= " --no-update" if defined $no_update;
-	$command .= " --workdir $workdir" if defined $workdir;
 	my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
 	    run( command => $command, verbose => 1 );
@@ -108,9 +109,13 @@
 	my $camera = $item->{camera};
 	
-	my $command = "$warp_skycell --warp_id $warp_id --skycell_id $skycell_id --tess_id $tess_id --camera $camera --dbname $dbname";
+	$workdir = $workdir_global unless defined $workdir and $workdir ne "NULL";
+	die "No working directory specified.\n" unless defined $workdir;
+	
+	my $outroot = caturi( $workdir, "tess_$tess_id", $skycell_id, "$tess_id.$skycell_id.wrp.$warp_id" );
+
+	my $command = "$warp_skycell --warp_id $warp_id --skycell_id $skycell_id --tess_id $tess_id --camera $camera --dbname $dbname --outroot $outroot";
 	$command .= " --verbose" if defined $verbose;
 	$command .= " --no-op" if defined $no_op;
 	$command .= " --no-update" if defined $no_update;
-	$command .= " --workdir $workdir" if defined $workdir and $workdir ne "NULL";
 	my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
 	    run( command => $command, verbose => 1 );
