summaryrefslogtreecommitdiff
path: root/modules/NMakeWorkspaceCreator.pm
diff options
context:
space:
mode:
authorelliott_c <ocielliottc@users.noreply.github.com>2005-09-30 12:48:44 +0000
committerelliott_c <ocielliottc@users.noreply.github.com>2005-09-30 12:48:44 +0000
commita8dabfab50c5d4d303aac9fb0556651882c51bcb (patch)
treed88c933453cce054806311af8d6f79cdcd05f68f /modules/NMakeWorkspaceCreator.pm
parentef9be6e5e75d19cae6c55042aa16d1bf66947498 (diff)
downloadMPC-a8dabfab50c5d4d303aac9fb0556651882c51bcb.tar.gz
ChangeLogTag: Fri Sep 30 07:46:54 2005 Chad Elliott <elliott_c@ociweb.com>
Diffstat (limited to 'modules/NMakeWorkspaceCreator.pm')
-rw-r--r--modules/NMakeWorkspaceCreator.pm22
1 files changed, 19 insertions, 3 deletions
diff --git a/modules/NMakeWorkspaceCreator.pm b/modules/NMakeWorkspaceCreator.pm
index 0794b6cc..3be47bf4 100644
--- a/modules/NMakeWorkspaceCreator.pm
+++ b/modules/NMakeWorkspaceCreator.pm
@@ -84,6 +84,7 @@ sub write_project_targets {
my($target) = shift;
my($list) = shift;
my($crlf) = $self->crlf();
+ my($cwd) = $self->getcwd();
foreach my $project (@$list) {
my($dir) = $self->mpc_dirname($project);
@@ -94,12 +95,27 @@ sub write_project_targets {
## 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);
}
}