Changeset 3283


Ignore:
Timestamp:
03/12/09 05:38:22 (3 years ago)
Author:
jquelin
Message:

copying the My Plugin if needed

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Padre/lib/Padre/Config/Constants.pm

    r3282 r3283  
    55package Padre::Config::Constants; 
    66 
     7use File::Basename        qw{ dirname }; 
     8use File::Copy            qw{ copy }; 
    79use File::Path            qw{ mkpath }; 
    810use File::Spec; 
     
    1012 
    1113# -- export stuff 
     14 
    1215use base qw{ Exporter }; 
    1316 
     
    8487# 
    8588# find and return the directory where padre should check the locally 
    86 # installed plugins. create it if needed. no params. 
     89# installed plugins. create it if needed. copy the My Plugin in it if 
     90# needed. 
     91# 
     92# no params. 
    8793# 
    8894sub _find_padre_plugin_dir { 
     
    97103 
    98104    # copy the My Plugin if necessary 
    99     my $file = catfile( $fullpath, 'My.pm' ); 
    100     unless ( -e $file ) { 
    101         Padre::Config->copy_original_My_plugin( $file ); 
     105    my $dst = catfile( $fullpath, 'My.pm' ); 
     106    unless ( -e $dst ) { 
     107        my $src = catfile( dirname($INC{'Padre/Config.pm'}), 'Plugin', 'My.pm' ); 
     108        die "Could not find the original My plugin" unless -e $src; 
     109        copy($src, $dst) or die "Could not copy the My plugin ($src) to $dst: $!"; 
     110        chmod( 0644, $dst); 
    102111    } 
    103112 
Note: See TracChangeset for help on using the changeset viewer.