Changeset 10615 for trunk/Padre/lib/Padre/Constant.pm
- Timestamp:
- 02/08/10 02:23:11 (2 years ago)
- File:
-
- 1 edited
-
trunk/Padre/lib/Padre/Constant.pm (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Padre/lib/Padre/Constant.pm
r10436 r10615 102 102 ); 103 103 104 use constant LOG_FILE => File::Spec->catfile( CONFIG_DIR, 'debug.log' );105 use constant PLUGIN_DIR => File::Spec->catdir( CONFIG_DIR, 'plugins' );106 use constant PLUGIN_LIB => File::Spec->catdir( PLUGIN_DIR, 'Padre', 'Plugin' );104 use constant LOG_FILE => File::Spec->catfile( CONFIG_DIR, 'debug.log' ); 105 use constant PLUGIN_DIR => File::Spec->catdir( CONFIG_DIR, 'plugins' ); 106 use constant PLUGIN_LIB => File::Spec->catdir( PLUGIN_DIR, 'Padre', 'Plugin' ); 107 107 use constant CONFIG_HOST => File::Spec->catfile( CONFIG_DIR, 'config.db' ); 108 108 use constant CONFIG_HUMAN => File::Spec->catfile( CONFIG_DIR, 'config.yml' ); 109 109 use constant CONFIG_STARTUP => File::Spec->catfile( CONFIG_DIR, 'startup.yml' ); 110 110 111 # Check and create the directories that need to exist 112 unless ( -e CONFIG_DIR or File::Path::mkpath(CONFIG_DIR) ) { 113 Carp::croak( "Cannot create config directory '" . CONFIG_DIR . "': $!" ); 111 # Do the initialisation in a function, 112 # so we can run it again later if needed. 113 sub init { 114 # Check and create the directories that need to exist 115 unless ( -e CONFIG_DIR or File::Path::mkpath(CONFIG_DIR) ) { 116 Carp::croak( "Cannot create config directory '" . CONFIG_DIR . "': $!" ); 117 } 118 unless ( -e PLUGIN_LIB or File::Path::mkpath(PLUGIN_LIB) ) { 119 Carp::croak( "Cannot create plug-ins directory '" . PLUGIN_LIB . "': $!" ); 120 } 114 121 } 115 unless ( -e PLUGIN_LIB or File::Path::mkpath(PLUGIN_LIB) ) { 116 Carp::croak( "Cannot create plug-ins directory '" . PLUGIN_LIB . "': $!" ); 122 123 BEGIN { 124 init(); 117 125 } 118 126 … … 132 140 # NOTE: The only reason this is here is that it is needed both during 133 141 # main configuration, and also during Padre::Startup. 134 use constant DEFAULT_SINGLEINSTANCE => ( WIN32 and not( $ENV{HARNESS_ACTIVE} or $^P ) ) ? 1 : 0; 142 use constant DEFAULT_SINGLEINSTANCE => ( 143 WIN32 and not( $ENV{HARNESS_ACTIVE} or $^P ) 144 ) ? 1 : 0; 135 145 136 146 use constant DEFAULT_SINGLEINSTANCE_PORT => 4444; 137 138 139 140 141 142 #####################################################################143 # Pseudo Constants144 145 my $revision;146 147 # Get the svn revision of the currently running Padre once:148 # eval 'use constant PADRE_REVISION => Padre::Util::revision;';149 # This needs to be a pseudo constant as it requires Padre::Util which150 # requires Padre::Constant (this module).151 sub PADRE_REVISION () {152 153 # Get and keep the revision at the first call of this pseudo-constant154 # (usually at Padre start)155 require Padre::Util;156 $revision ||= Padre::Util::revision();157 return $revision;158 }159 147 160 148 1;
Note: See TracChangeset
for help on using the changeset viewer.
