Changeset 3280


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

new exported constant $PADRE_PLUGIN_DIR

File:
1 edited

Legend:

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

    r3279 r3280  
    1212use base qw{ Exporter }; 
    1313 
    14 my @dirs   = qw{ $PADRE_CONFIG_DIR                      }; 
     14my @dirs   = qw{ $PADRE_CONFIG_DIR $PADRE_PLUGIN_DIR    }; 
    1515my @files  = qw{ $CONFIG_FILE_HOST $CONFIG_FILE_USER    }; 
    1616my @stores = qw{ $HOST $HUMAN $PROJECT                  }; 
     
    3030# files & dirs 
    3131our $PADRE_CONFIG_DIR = _find_padre_config_dir(); 
     32our $PADRE_PLUGIN_DIR = _find_padre_plugin_dir(); 
    3233our $CONFIG_FILE_USER = catfile( $PADRE_CONFIG_DIR, 'config.yml' ); 
    3334our $CONFIG_FILE_HOST = catfile( $PADRE_CONFIG_DIR, 'config.db'  ); 
     
    7778 
    7879 
     80# 
     81# my $dir = _find_padre_plugin_dir(); 
     82# 
     83# find and return the directory where padre should check the locally 
     84# installed plugins. no params. 
     85# 
     86sub _find_padre_plugin_dir { 
     87    my $pluginsdir = catdir( $PADRE_CONFIG_DIR, 'plugins' ); 
     88 
     89    # check if plugin directory exists, create it otherwise 
     90    my $fullpath = catdir( $pluginsdir, 'Padre', 'Plugin'   ); 
     91    unless ( -e $fullpath ) { 
     92        mkpath($fullpath) or 
     93        die "Cannot create plugins dir '$fullpath': $!"; 
     94    } 
     95 
     96    # copy the My Plugin if necessary 
     97    my $file = catfile( $fullpath, 'My.pm' ); 
     98    unless ( -e $file ) { 
     99        Padre::Config->copy_original_My_plugin( $file ); 
     100    } 
     101 
     102    return $pluginsdir; 
     103} 
     104 
     105 
    791061; 
    80107 
     
    132159 
    133160 
     161=item * $PADRE_PLUGIN_DIR 
     162 
     163Private directory where Padre can look for plugins. 
     164 
     165 
    134166=back 
    135167 
     
    153185=item * dirs 
    154186 
    155 Imports C<$PADRE_CONFIG_DIR>. 
     187Imports C<$PADRE_CONFIG_DIR> and C<$PADRE_PLUGIN_DIR>. 
    156188 
    157189=item * files 
Note: See TracChangeset for help on using the changeset viewer.