Index: /trunk/ippScripts/scripts/detrend_reject_imfile.pl
===================================================================
--- /trunk/ippScripts/scripts/detrend_reject_imfile.pl	(revision 9256)
+++ /trunk/ippScripts/scripts/detrend_reject_imfile.pl	(revision 9257)
@@ -11,4 +11,8 @@
 use PS::IPP::Metadata::List qw( parse_md_list );
 use Statistics::Descriptive;
+
+use PS::IPP::Config;
+my $ipprc = PS::IPP::Config->new(); # IPP configuration
+use File::Spec;
 
 use Getopt::Long qw( GetOptions :config auto_help auto_version gnu_getopt );
@@ -96,6 +100,10 @@
 }
 
+my $example = ${$files}[0]->{b1_uri}; # Example file
+my ($vol, $dir, $file) = File::Spec->splitpath( $example );
+
 # Generate the file list, and get the statistics
 my $outputRoot = $exp_tag . '.detresid.' . $det_id . '.' . $iter; # Root output name
+$outputRoot = File::Spec->rel2abs( File::Spec->catpath( $vol, $dir, $outputRoot ), $ipprc->workdir() );
 my $list1Name = $outputRoot . '.b1.list'; # Name for the input file list for binning 1
 my $list2Name = $outputRoot . '.b2.list'; # Name for the input file list for binning 2
@@ -105,6 +113,6 @@
 open my $list2File, '>' . $list2Name;
 foreach my $file (@$files) {
-    print $list1File $file->{b1_uri} . "\n";
-    print $list2File $file->{b2_uri} . "\n";
+    print $list1File File::Spec->rel2abs( $file->{b1_uri}, $ipprc->workdir() ) . "\n";
+    print $list2File File::Spec->rel2abs( $file->{b2_uri}, $ipprc->workdir() ) . "\n";
     push @means, $file->{bg};
     push @stdevs, $file->{bg_stdev};
@@ -194,4 +202,6 @@
 
 # Add the result into the database
+$jpeg1Name = File::Spec->abs2rel( $jpeg1Name, $ipprc->workdir() );
+$jpeg2Name = File::Spec->abs2rel( $jpeg2Name, $ipprc->workdir() );
 unless ($no_update) {
     my $command = "$dettool -addresidexp -det_id $det_id -iteration $iter -exp_tag $exp_tag " .
@@ -202,4 +212,7 @@
 	run(command => $command, verbose => 1);
     die "Unable to perform dettool -addresidexp: $error_code\n" if not $success;
+
+    unlink $list1Name;
+    unlink $list2Name;
 }
 
