Skip to content

Commit 63bd8cc

Browse files
committed
Thu May 16 17:46:26 UTC 2019 Chad Elliott <elliott_c@ociweb.com>
1 parent bdcd527 commit 63bd8cc

5 files changed

Lines changed: 46 additions & 10 deletions

File tree

ChangeLog

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
Thu May 16 17:46:26 UTC 2019 Chad Elliott <elliott_c@ociweb.com>
2+
3+
* modules/DirectoryManager.pm:
4+
* modules/IARWorkspaceCreator.pm:
5+
* modules/TemplateParser.pm:
6+
* templates/iar.mpd:
7+
8+
Made it so the $WS_DIR$ and $PROJ_DIR$ variables are prepended
9+
only if the path is relative.
10+
111
Wed May 15 18:25:52 UTC 2019 Chad Elliott <elliott_c@ociweb.com>
212

313
* templates/iar.mpd:

modules/DirectoryManager.pm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ sub path_is_relative {
196196
## To determine if the path is relative, we just determine if it is not
197197
## an absolute path.
198198
#my($self, $path) = @_;
199-
return (index($_[1], '/') != 0 && $_[1] !~ /^[A-Z]:\//i);
199+
return (index($_[1], '/') != 0 && $_[1] !~ /^[A-Z]:[\/\\]/i && $_[1] !~ /^\$\(\w+\)/);
200200
}
201201

202202
# ************************************************************

modules/IARWorkspaceCreator.pm

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,12 @@ sub write_comps {
5353
$self->create_command_line_string($0, @ARGV),
5454
' -->', $crlf;
5555
foreach my $project ($self->sort_dependencies($self->get_projects(), 0)) {
56+
## Only emit the prefix if the path is relative. IAR requires it unless
57+
## the path is fully qualified.
5658
print $fh " <project>$crlf",
57-
" <path>\$WS_DIR\$\\", $self->slash_to_backslash($project),
58-
"</path>$crlf",
59+
" <path>";
60+
print $fh '$WS_DIR$\\' if ($self->path_is_relative($project));
61+
print $fh $self->slash_to_backslash($project), "</path>$crlf",
5962
" </project>$crlf";
6063
}
6164
}

modules/TemplateParser.pm

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ my %keywords = ('if' => 0,
9191
'new_guid' => 0,
9292
'deref' => 0,
9393
'set' => 0,
94+
'is_relative' => $get_type|$doif_type|$get_combined_type,
9495
);
9596

9697
my %target_type_vars = ('type_is_static' => 1,
@@ -1991,6 +1992,28 @@ sub handle_set {
19911992
}
19921993
}
19931994

1995+
1996+
sub get_is_relative {
1997+
my($self, $name) = @_;
1998+
return $self->doif_is_relative($self->get_value_with_default($name));
1999+
}
2000+
2001+
2002+
sub doif_is_relative {
2003+
my($self, $val) = @_;
2004+
return $self->{'prjc'}->path_is_relative($val) if (defined $val);
2005+
return undef;
2006+
}
2007+
2008+
2009+
sub handle_is_relative {
2010+
my($self, $name) = @_;
2011+
my $val = $self->get_value_with_default($name);
2012+
$self->append_current(
2013+
$self->{'prjc'}->path_is_relative($val) ? '1' : '0') if (defined $val);
2014+
}
2015+
2016+
19942017
sub prepare_parameters {
19952018
my($self, $prefix) = @_;
19962019
my $input = $self->get_value($prefix . '->input_file');

templates/iar.mpd

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@
363363
<option>
364364
<name>CCIncludePath2</name>
365365
<%foreach(includes)%>
366-
<state><%include%></state>
366+
<state><%if(is_relative(include))%>$PROJ_DIR$/<%endif%><%include%></state>
367367
<%endfor%>
368368
</option>
369369
<option>
@@ -1071,7 +1071,7 @@
10711071
<name>Documentation Files</name>
10721072
<%foreach(documentation_files)%>
10731073
<file>
1074-
<name>$PROJ_DIR$\<%documentation_file%></name>
1074+
<name><%if(is_relative(documentation_file))%>$PROJ_DIR$/<%endif%><%documentation_file%></name>
10751075
</file>
10761076
<%endfor%>
10771077
</group>
@@ -1081,7 +1081,7 @@
10811081
<name>Header Files</name>
10821082
<%foreach(header_files)%>
10831083
<file>
1084-
<name>$PROJ_DIR$\<%header_file%></name>
1084+
<name><%if(is_relative(header_file))%>$PROJ_DIR$/<%endif%><%header_file%></name>
10851085
</file>
10861086
<%endfor%>
10871087
</group>
@@ -1091,7 +1091,7 @@
10911091
<name>Inline Files</name>
10921092
<%foreach(inline_files)%>
10931093
<file>
1094-
<name>$PROJ_DIR$\<%inline_file%></name>
1094+
<name><%if(is_relative(inline_file))%>$PROJ_DIR$/<%endif%><%inline_file%></name>
10951095
</file>
10961096
<%endfor%>
10971097
</group>
@@ -1101,7 +1101,7 @@
11011101
<name>Source Files</name>
11021102
<%foreach(source_files)%>
11031103
<file>
1104-
<name>$PROJ_DIR$\<%source_file%></name>
1104+
<name><%if(is_relative(source_file))%>$PROJ_DIR$/<%endif%><%source_file%></name>
11051105
</file>
11061106
<%endfor%>
11071107
</group>
@@ -1111,7 +1111,7 @@
11111111
<name>Template Files</name>
11121112
<%foreach(template_files)%>
11131113
<file>
1114-
<name>$PROJ_DIR$\<%template_file%></name>
1114+
<name><%if(is_relative(template_file))%>$PROJ_DIR$/<%endif%><%template_file%></name>
11151115
<excluded>
11161116
<%foreach(configurations)%>
11171117
<configuration><%configuration%></configuration>
@@ -1127,7 +1127,7 @@
11271127
<name><%ucw(custom_type)%></name>
11281128
<%foreach(custom_type->input_files)%>
11291129
<file>
1130-
<name>$PROJ_DIR$\<%custom_type->input_file%></name>
1130+
<name><%if(is_relative(custom_type->input_file))%>$PROJ_DIR$/<%endif%><%custom_type->input_file%></name>
11311131
<%if(custom_type->input_file->output_files)%>
11321132
<%foreach(configurations)%>
11331133
<configuration>

0 commit comments

Comments
 (0)