Changeset 27303 for main/trunk/greenstone2/perllib/plugin.pm
- Timestamp:
- 2013-05-06T15:23:45+12:00 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone2/perllib/plugin.pm
r26223 r27303 32 32 33 33 require util; 34 use FileUtils; 34 35 use gsprintf 'gsprintf'; 35 36 … … 84 85 # pp_plugname shorthand for 'perllib' 'plugin' '$pluginname.pm' 85 86 my $pp_plugname 86 = & util::filename_cat('perllib', 'plugins', "${pluginname}.pm");87 = &FileUtils::filenameConcatenate('perllib', 'plugins', "${pluginname}.pm"); 87 88 my $collectdir = $ENV{'GSDLCOLLECTDIR'}; 88 89 … … 91 92 { 92 93 my $customplugname 93 = & util::filename_cat($collectdir, "custom",$ENV{'GSDLCOLLECTION'},94 = &FileUtils::filenameConcatenate($collectdir, "custom",$ENV{'GSDLCOLLECTION'}, 94 95 $pp_plugname); 95 96 push(@check_list,$customplugname); 96 97 } 97 98 98 my $colplugname = & util::filename_cat($collectdir, $pp_plugname);99 my $colplugname = &FileUtils::filenameConcatenate($collectdir, $pp_plugname); 99 100 push(@check_list,$colplugname); 100 101 101 102 if (defined $ENV{'GSDLEXTS'}) { 102 103 103 my $ext_prefix = & util::filename_cat($ENV{'GSDLHOME'}, "ext");104 my $ext_prefix = &FileUtils::filenameConcatenate($ENV{'GSDLHOME'}, "ext"); 104 105 105 106 my @extensions = split(/:/,$ENV{'GSDLEXTS'}); 106 107 foreach my $e (@extensions) { 107 my $extplugname = & util::filename_cat($ext_prefix, $e, $pp_plugname);108 my $extplugname = &FileUtils::filenameConcatenate($ext_prefix, $e, $pp_plugname); 108 109 push(@check_list,$extplugname); 109 110 … … 112 113 if (defined $ENV{'GSDL3EXTS'}) { 113 114 114 my $ext_prefix = & util::filename_cat($ENV{'GSDL3SRCHOME'}, "ext");115 my $ext_prefix = &FileUtils::filenameConcatenate($ENV{'GSDL3SRCHOME'}, "ext"); 115 116 116 117 my @extensions = split(/:/,$ENV{'GSDL3EXTS'}); 117 118 foreach my $e (@extensions) { 118 my $extplugname = & util::filename_cat($ext_prefix, $e, $pp_plugname);119 my $extplugname = &FileUtils::filenameConcatenate($ext_prefix, $e, $pp_plugname); 119 120 push(@check_list,$extplugname); 120 121 … … 123 124 124 125 125 my $mainplugname = & util::filename_cat($ENV{'GSDLHOME'}, $pp_plugname);126 my $mainplugname = &FileUtils::filenameConcatenate($ENV{'GSDLHOME'}, $pp_plugname); 126 127 push(@check_list,$mainplugname); 127 128 … … 130 131 if (-e $plugname) { 131 132 # lets add perllib folder to INC 133 # check it isn't already there first [jmt12] 132 134 my ($perllibfolder) = $plugname =~ /^(.*[\/\\]perllib)[\/\\]plugins/; 133 if (-d $perllibfolder) { 135 if (-d $perllibfolder) 136 { 137 my $found_perllibfolder = 0; 138 foreach my $path (@INC) 139 { 140 if ($path eq $perllibfolder) 141 { 142 $found_perllibfolder = 1; 143 last; 144 } 145 } 146 if (!$found_perllibfolder) 147 { 134 148 unshift (@INC, $perllibfolder); 135 } 149 } 150 } 136 151 require $plugname; 137 152 $success=1; … … 171 186 $failhandle = 'STDERR' unless defined $failhandle; 172 187 173 my $colperllibdir = &util::filename_cat($ENV{'GSDLCOLLECTDIR'},"perllib");174 unshift (@INC, $colperllibdir);175 my $colplugindir = &util::filename_cat($colperllibdir,"plugins");176 unshift (@INC, $colplugindir);188 # before pushing collection perl and plugin directories onto INC, test that 189 # they aren't already there [jmt12] 190 &util::augmentINC(&FileUtils::filenameConcatenate($ENV{'GSDLCOLLECTDIR'},'perllib')); 191 &util::augmentINC(&FileUtils::filenameConcatenate($ENV{'GSDLCOLLECTDIR'},'perllib','plugins')); 177 192 178 193 map { $_ = "\"$_\""; } @$globaloptions; … … 270 285 # the .kill file is a handy (if not very elegant) way of aborting 271 286 # an import.pl or buildcol.pl process 272 if (-e & util::filename_cat($ENV{'GSDLCOLLECTDIR'}, ".kill")) {287 if (-e &FileUtils::filenameConcatenate($ENV{'GSDLCOLLECTDIR'}, ".kill")) { 273 288 gsprintf($outhandle, "{plugin.kill_file}\n"); 274 289 die "\n"; … … 301 316 # the .kill file is a handy (if not very elegant) way of aborting 302 317 # an import.pl or buildcol.pl process 303 if (-e & util::filename_cat($ENV{'GSDLCOLLECTDIR'}, ".kill")) {318 if (-e &FileUtils::filenameConcatenate($ENV{'GSDLCOLLECTDIR'}, ".kill")) { 304 319 gsprintf($outhandle, "{plugin.kill_file}\n"); 305 320 die "\n"; … … 352 367 # the .kill file is a handy (if not very elegant) way of aborting 353 368 # an import.pl or buildcol.pl process 354 if (-e & util::filename_cat($ENV{'GSDLCOLLECTDIR'}, ".kill")) {369 if (-e &FileUtils::filenameConcatenate($ENV{'GSDLCOLLECTDIR'}, ".kill")) { 355 370 gsprintf($outhandle, "{plugin.kill_file}\n"); 356 371 die "\n";
Note:
See TracChangeset
for help on using the changeset viewer.