summaryrefslogtreecommitdiff
path: root/prj_install.pl
diff options
context:
space:
mode:
authorelliott_c <ocielliottc@users.noreply.github.com>2007-08-16 11:59:09 +0000
committerelliott_c <ocielliottc@users.noreply.github.com>2007-08-16 11:59:09 +0000
commite09c8b93d4866bcda67090e60d60b0178e81dac2 (patch)
tree7068bc9619a2ee1c1ff200bc94a81270778310c0 /prj_install.pl
parent26f80af0c0bc70d5c9ecc57c218b60a164296147 (diff)
downloadMPC-e09c8b93d4866bcda67090e60d60b0178e81dac2.tar.gz
ChangeLogTag: Thu Aug 16 12:01:28 UTC 2007 Chad Elliott <elliott_c@ociweb.com>
Diffstat (limited to 'prj_install.pl')
-rwxr-xr-xprj_install.pl27
1 files changed, 23 insertions, 4 deletions
diff --git a/prj_install.pl b/prj_install.pl
index 1e73c677..e9f27e6e 100755
--- a/prj_install.pl
+++ b/prj_install.pl
@@ -23,7 +23,7 @@ use File::Basename;
# ******************************************************************
my($insext) = 'ins';
-my($version) = '1.7';
+my($version) = '1.8';
my(%defaults) = ('header_files' => 1,
'idl_files' => 1,
'inline_files' => 1,
@@ -48,6 +48,21 @@ my($hasSymlink) = ($@ eq '');
# Subroutine Section
# ******************************************************************
+sub rm_updirs {
+ my($path) = shift;
+ my(@parts) = split(/[\/\\]/, $path);
+
+ ## Split the path into parts and check for '..'. If we find one
+ ## and the previous entry wasn't one, then we can remove them both.
+ for(my $i = 0; $i <= $#parts; $i++) {
+ if ($i > 0 && $parts[$i] eq '..' && $parts[$i - 1] ne '..') {
+ splice(@parts, $i - 1, 2);
+ $i -= 2;
+ }
+ }
+ return join('/', @parts);
+}
+
sub copyFiles {
my($files) = shift;
my($insdir) = shift;
@@ -57,9 +72,10 @@ sub copyFiles {
my($cwd) = getcwd();
foreach my $file (@$files) {
- my($dest) = $insdir . '/' .
- (defined $actual{$file} ?
- "$actual{$file}/" . basename($file) : $file);
+ my($dest) = rm_updirs($insdir . '/' .
+ (defined $actual{$file} ?
+ "$actual{$file}/" .
+ basename($file) : $file));
my($fulldir) = dirname($dest);
if (! -d $fulldir) {
my($tmp) = '';
@@ -80,6 +96,9 @@ sub copyFiles {
}
else {
$status = copy($file, $dest);
+ if ($status && -x $file) {
+ chmod(0755, $dest);
+ }
}
if (!$status) {
print STDERR "ERROR: Unable to $type $file to $dest\n";