diff options
author | Adam Mitz <mitza-oci@users.noreply.github.com> | 2010-06-16 22:16:42 +0000 |
---|---|---|
committer | Adam Mitz <mitza-oci@users.noreply.github.com> | 2010-06-16 22:16:42 +0000 |
commit | 6294a25e64752df43757374473f294cac8565a69 (patch) | |
tree | d6c644d2b2c696a04b86d6f990faa709e4ccff13 | |
parent | 4e430101658567baeec89039f318e79939886520 (diff) | |
download | MPC-6294a25e64752df43757374473f294cac8565a69.tar.gz |
added a convert_slashes() template function for getting the slashes right on windows in the dllout/libout/exeout scriptlet
-rw-r--r-- | modules/TemplateParser.pm | 23 | ||||
-rw-r--r-- | templates/cdt6cproject.mpd | 6 |
2 files changed, 25 insertions, 4 deletions
diff --git a/modules/TemplateParser.pm b/modules/TemplateParser.pm index b5696104..ab06b6be 100644 --- a/modules/TemplateParser.pm +++ b/modules/TemplateParser.pm @@ -78,6 +78,7 @@ my %keywords = ('if' => 0, 'create_aux_file' => 0x12, 'end_aux_file' => 0, 'translate_vars' => 2, + 'convert_slashes' => 2, ); my %target_type_vars = ('type_is_static' => 1, @@ -1796,12 +1797,32 @@ sub perform_translate_vars { ? $arg->[1] : $self->{'prjc'}->{'command_subs'}->{'os'}; my ($pre, $post) = ($os eq 'win32') ? ('%', '%') : ('${', '}'); $val =~ s[\$\(([^)]+)\)(\S*)][my ($var, $rest) = ($1, $2); - $rest =~ s!\/!\\!g if $os eq 'win32'; + $rest =~ s!/!\\!g if $os eq 'win32'; "$pre$var$post$rest"]ge; return $val; } +sub handle_convert_slashes { + my $self = shift; + my $arg = shift; + my @params = $self->split_parameters($arg); + $self->append_current($self->perform_convert_slashes([@params])); +} + + +sub perform_convert_slashes { + my $self = shift; + my $arg = shift; + my $val = $self->get_value($arg->[0]); + $val = $arg->[0] unless defined $val; + my $os = (defined $arg->[1] && $arg->[1] ne '') + ? $arg->[1] : $self->{'prjc'}->{'command_subs'}->{'os'}; + $val =~ s!/!\\!g if $os eq 'win32'; + return $val; +} + + sub prepare_parameters { my($self, $prefix) = @_; my $input = $self->get_value($prefix . '->input_file'); diff --git a/templates/cdt6cproject.mpd b/templates/cdt6cproject.mpd index ed570d3c..061cb31b 100644 --- a/templates/cdt6cproject.mpd +++ b/templates/cdt6cproject.mpd @@ -36,9 +36,9 @@ parent="<%configuration_parent_root%>.<%if(platform_specializer)%><%platform_specializer%>.<%endif%><%project_type%>.<%configuration%>" prebuildStep="<%eval(prebuild)%>" postbuildStep="<%shell%> ..<%slash%><%create_aux_file(postbuild_, platform, _, configuration, script_ext)%><%script_hdr%> -<%if(type_is_dynamic)%><%cp%> <%lib_prefix%><%sharedname%><%lib_modifier%><%dll_ext%> <%if(dllout)%><%if(!starts_with(dllout, [/\\\$]))%>..<%slash%>..<%slash%><%endif%><%dllout%><%else%><%if(libout)%><%if(!starts_with(libout, [/\\\$]))%>..<%slash%>..<%slash%><%endif%><%libout%><%else%>.<%endif%><%endif%><%else%> -<%if(type_is_static)%><%cp%> <%lib_prefix%><%staticname%><%lib_modifier%><%lib_ext%> <%if(libout)%><%if(!starts_with(libout, [/\\\$]))%>..<%slash%>..<%endif%><%libout%><%else%>.<%endif%><%else%> -<%if(exename)%><%cp%> <%exename%><%exe_ext%> <%if(exeout)%><%if(!starts_with(exeout, [/\\\$]))%>..<%slash%>..<%endif%><%else%>.<%endif%><%endif%> +<%if(type_is_dynamic)%><%cp%> <%lib_prefix%><%sharedname%><%lib_modifier%><%dll_ext%> <%if(dllout)%><%if(!starts_with(dllout, [/\\\$]))%>..<%slash%>..<%slash%><%endif%><%convert_slashes(dllout)%><%else%><%if(libout)%><%if(!starts_with(libout, [/\\\$]))%>..<%slash%>..<%slash%><%endif%><%convert_slashes(libout)%><%else%>.<%endif%><%endif%><%else%> +<%if(type_is_static)%><%cp%> <%lib_prefix%><%staticname%><%lib_modifier%><%lib_ext%> <%if(libout)%><%if(!starts_with(libout, [/\\\$]))%>..<%slash%>..<%endif%><%convert_slashes(libout)%><%else%>.<%endif%><%else%> +<%if(exename)%><%cp%> <%exename%><%exe_ext%> <%if(exeout)%><%if(!starts_with(exeout, [/\\\$]))%>..<%slash%>..<%endif%><%convert_slashes(exeout)%><%else%>.<%endif%><%endif%> <%endif%><%endif%> <%if(postbuild)%><%eval(postbuild)%><%endif%> <%end_aux_file%>" |