From a5a0f32e1970734ba51a3075ddd7d464771408ef Mon Sep 17 00:00:00 2001 From: Alessandro Ranellucci Date: Fri, 16 Nov 2012 10:07:30 +0100 Subject: [PATCH] Expose all SLIC3R_* environment variables as placeholders. #781 --- lib/Slic3r/Config.pm | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/Slic3r/Config.pm b/lib/Slic3r/Config.pm index 06185ad1e..0bf7d7e95 100644 --- a/lib/Slic3r/Config.pm +++ b/lib/Slic3r/Config.pm @@ -1156,9 +1156,11 @@ sub replace_options { my $self = shift; my ($string, $more_variables) = @_; - if ($more_variables) { - my $variables = join '|', keys %$more_variables; - $string =~ s/\[($variables)\]/$more_variables->{$1}/eg; + $more_variables ||= {}; + $more_variables->{$_} = $ENV{$_} for grep /^SLIC3R_/, keys %ENV; + { + my $variables_regex = join '|', keys %$more_variables; + $string =~ s/\[($variables_regex)\]/$more_variables->{$1}/eg; } my @lt = localtime; $lt[5] += 1900; $lt[4] += 1;