tools: More back-slash escape fixes
Thanks to Stephen Norum for pointing most of these out and testing the patch.
This commit is contained in:
@@ -144,6 +144,7 @@ sub cdCommands {
|
||||
|
||||
my $startup = $cwd;
|
||||
$startup =~ s/^$root/$iocroot/o if ($opt_t);
|
||||
$startup =~ s/([\\"])/\\\1/g; # escape back-slashes and double-quotes
|
||||
|
||||
print OUT "startup = \"$startup\"\n";
|
||||
|
||||
@@ -156,6 +157,7 @@ sub cdCommands {
|
||||
foreach my $app (@includes) {
|
||||
my $iocpath = my $path = $macros{$app};
|
||||
$iocpath =~ s/^$root/$iocroot/o if ($opt_t);
|
||||
$iocpath =~ s/([\\"])/\\\1/g; # escape back-slashes and double-quotes
|
||||
my $app_lc = lc($app);
|
||||
print OUT "$app_lc = \"$iocpath\"\n"
|
||||
if (-d $path);
|
||||
@@ -187,6 +189,7 @@ sub envPaths {
|
||||
foreach my $app (@includes) {
|
||||
my $iocpath = my $path = $macros{$app};
|
||||
$iocpath =~ s/^$root/$iocroot/o if ($opt_t);
|
||||
$iocpath =~ s/([\\"])/\\\1/g; # escape back-slashes and double-quotes
|
||||
print OUT "epicsEnvSet(\"$app\",\"$iocpath\")\n" if (-d $path);
|
||||
}
|
||||
close OUT;
|
||||
|
||||
@@ -28,6 +28,9 @@ $Getopt::Std::OUTPUT_HELP_VERSION = 1;
|
||||
|
||||
my $path = AbsPath(shift);
|
||||
|
||||
# Escape shell special characters unless on Windows, which doesn't allow them.
|
||||
$path =~ s/([!"\$&'\(\)*,:;<=>?\[\\\]^`{|}])/\\\1/g unless $^O eq 'MSWin32';
|
||||
|
||||
print "$path\n";
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user