summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohnny Willemsen <jwillemsen@remedy.nl>2005-09-30 13:34:03 +0000
committerJohnny Willemsen <jwillemsen@remedy.nl>2005-09-30 13:34:03 +0000
commit65c7ebd263dafc7504e463b0dbe28307c06bf393 (patch)
treeea33074192d30d57d80e54860b955ced046cf459
parentc24705d8849f098ea166e07bac04c0eb9aad90d0 (diff)
downloadATCD-65c7ebd263dafc7504e463b0dbe28307c06bf393.tar.gz
ChangeLogTag: Fri Sep 30 13:33:12 UTC 2005 Johnny Willemsen <jwillemsen@remedy.nl>
-rw-r--r--bin/MakeProjectCreator/modules/BorlandWorkspaceCreator.pm24
1 files changed, 20 insertions, 4 deletions
diff --git a/bin/MakeProjectCreator/modules/BorlandWorkspaceCreator.pm b/bin/MakeProjectCreator/modules/BorlandWorkspaceCreator.pm
index 9fe8f0b9fef..95dbd88478e 100644
--- a/bin/MakeProjectCreator/modules/BorlandWorkspaceCreator.pm
+++ b/bin/MakeProjectCreator/modules/BorlandWorkspaceCreator.pm
@@ -73,17 +73,33 @@ sub write_project_targets {
my($dir) = $self->mpc_dirname($project);
my($chdir) = 0;
my($back) = '';
+ my($cwd) = $self->getcwd();
- ## If the directory isn't "." then we need
+ ## If the directory isn't '.' then we need
## to figure out how to get back to our starting point
if ($dir ne '.') {
$chdir = 1;
- my($count) = ($dir =~ tr/\///);
+ my($count) = ($dir =~ tr/\///) + 1;
if ($dir =~ /^\.\.\//) {
- $back = ('../' x $count) . basename($self->getcwd());
+ ## Find out how many directories we went down
+ my($rel) = $dir;
+ while($rel =~ s/^\.\.\///) {
+ }
+ my($down) = ($rel =~ tr/\///) + 1;
+
+ ## Get $count - $down parts of the base of the current directory
+ $rel = $cwd;
+ my($index) = length($rel);
+ for(my $i = $down; $i < $count; $i++) {
+ $index = rindex($rel, '/', $index - 1);
+ }
+ if ($index > -1) {
+ $rel = substr($rel, $index + 1);
+ }
+ $back = ('../' x $down) . $rel;
}
else {
- $back = ('../' x ($count + 1));
+ $back = ('../' x $count);
}
}