Index: trunk/ippScripts/scripts/detrend_reject_exp.pl
===================================================================
--- trunk/ippScripts/scripts/detrend_reject_exp.pl	(revision 12800)
+++ trunk/ippScripts/scripts/detrend_reject_exp.pl	(revision 13275)
@@ -17,15 +17,14 @@
 use PS::IPP::Metadata::List qw( parse_md_list );
 use Statistics::Descriptive;
-use File::Spec;
-
-use PS::IPP::Config qw(
-    $PS_EXIT_SUCCESS
-    $PS_EXIT_UNKNOWN_ERROR
-    $PS_EXIT_SYS_ERROR
-    $PS_EXIT_CONFIG_ERROR
-    $PS_EXIT_PROG_ERROR
-    $PS_EXIT_DATA_ERROR
-    $PS_EXIT_TIMEOUT_ERROR
-    );
+
+use PS::IPP::Config qw($PS_EXIT_SUCCESS
+		       $PS_EXIT_UNKNOWN_ERROR
+		       $PS_EXIT_SYS_ERROR
+		       $PS_EXIT_CONFIG_ERROR
+		       $PS_EXIT_PROG_ERROR
+		       $PS_EXIT_DATA_ERROR
+		       $PS_EXIT_TIMEOUT_ERROR
+		       caturi
+		       );
 my $ipprc = PS::IPP::Config->new(); # IPP configuration
 
@@ -122,15 +121,11 @@
 my $reject_meanstdev = rejection_limit( 'ENSEMBLE.MEANSTDEV', $det_type, $filter );
 
-my $logName = "$camera.$det_type.$det_id.$iter.detreject.log"; # Name for log
-if (defined $workdir) {
-    $workdir = $ipprc->convert_filename_absolute( $workdir );
-    my $subdir = "$camera.$det_type.$det_id";
-    $workdir = File::Spec->catdir( $workdir, $subdir );
-    system "mkdir -p $workdir" unless -d $workdir;
-    $logName = File::Spec->catfile( $workdir, $logName );
-}
+$workdir = caturi( $workdir, "$camera.$det_type.$det_id" ) if defined $workdir;
+
+my $logName = $ipprc->file_prepare( "$camera.$det_type.$det_id.$iter.detreject.log", $workdir ); # Name for log
+
 my $logFile;
 unless ($no_op) {
-    open $logFile, "> $logName" or &my_die("Unable to open log file $logName.\n", $det_id, $iter, $PS_EXIT_SYS_ERROR);
+    $logFile = $ipprc->file_create_open( $logName );
     print $logFile "Ensemble mean " . $meanStats->mean() . " +/- " . $meanStats->standard_deviation .
 	", stdev " . $stdevStats->mean() . " +/- " . $stdevStats->standard_deviation() . "\n\n";
