[Bio] / FigKernelPackages / FIG.pm Repository:
ViewVC logotype

Diff of /FigKernelPackages/FIG.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.571, Fri Feb 9 23:05:17 2007 UTC revision 1.572, Sun Feb 11 22:37:11 2007 UTC
# Line 2927  Line 2927 
2927      return \$rev;      return \$rev;
2928  }  }
2929    
2930    # This routine was written by Gary to definitively handle the "scratch" subdirectory issue.
2931    # It takes as parameters key-value pairs.  The relevant ones are
2932    #
2933    #     tmpdir => NameOfTmpDirectoryToBeUsed  [can be ommitted]
2934    #     tmp    => TheNameOfTheTmpDirectoryToContainTheSubdirectory [can be ommitted]
2935    #
2936    # if tmpdir exists, save_tmp is set to "true".  You need to test this at the end
2937    # of your script and blow away the directory unless save_tmp is true.
2938    # if tmpdir does not exist, it will be created if possible.
2939    #
2940    # tmp is where to put tmpdir, if it is not specified.  if tmp is omitted, it
2941    # will all be ok.
2942    #
2943    #- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
2944    #  ( $tmp_dir, $save_tmp ) = temporary_directory( \%options )
2945    #- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
2946    sub temporary_directory
2947    {
2948        my $options = shift;
2949    
2950        my $tmp_dir  = $options->{ tmpdir };
2951        my $save_tmp = $options->{ savetmp } || '';
2952    
2953        if ( $tmp_dir )
2954        {
2955            if ( -d $tmp_dir ) { $options->{ savetmp } = $save_tmp = 1 }
2956        }
2957        else
2958        {
2959            my $tmp = $options->{ tmp } && -d  $options->{ tmp } ?  $options->{ tmp }
2960                    : $FIG_Config::temp && -d  $FIG_Config::temp ?  $FIG_Config::temp
2961                    :                      -d '/tmp'             ? '/tmp'
2962                    :                                              '.';
2963            $tmp_dir = sprintf( "$tmp/fig_tmp_dir.%05d.%09d", $$, int(1000000000*rand) );
2964        }
2965    
2966        if ( $tmp_dir && ! -d $tmp_dir )
2967        {
2968            mkdir $tmp_dir;
2969            if ( ! -d $tmp_dir )
2970            {
2971                print STDERR "FIG::temporary_directory could not create '$tmp_dir'\n";
2972                $options->{ tmpdir } = $tmp_dir = undef;
2973            }
2974        }
2975    
2976        return ( $tmp_dir, $save_tmp );
2977    }
2978    
2979  sub verify_external_tool {  sub verify_external_tool {
2980      my(@progs) = @_;      my(@progs) = @_;
2981    

Legend:
Removed from v.1.571  
changed lines
  Added in v.1.572

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3