From c5465b860bacd3839446c38d988c6bdc14c539fe Mon Sep 17 00:00:00 2001 From: Christian Lohmaier Date: Thu, 29 Oct 2015 14:31:35 +0100 Subject: filelist split: condition the pattern instead the whole block avoids a more complex regex with branches, and doesn't duplicate the execution block Change-Id: I48550c7ea2938001c139b9baecd1282727d7db31 --- solenv/bin/modules/installer/filelists.pm | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) (limited to 'solenv/bin') diff --git a/solenv/bin/modules/installer/filelists.pm b/solenv/bin/modules/installer/filelists.pm index 7ca2f8104c32..9c168c78472f 100644 --- a/solenv/bin/modules/installer/filelists.pm +++ b/solenv/bin/modules/installer/filelists.pm @@ -115,27 +115,19 @@ sub read_filelist my $content = installer::files::read_file($path); my @filelist = (); + # split on space, but only if followed by / (don't split within a filename) + my $splitRE = qr!\s+(?=/)!; + # filelist on win have C:/cygwin style however + $splitRE = qr!\s+(?=[A-Z]:/)! if ($installer::globals::os eq "WNT"); + foreach my $line (@{$content}) { chomp $line; - if ($installer::globals::os eq "WNT") # FIXME hack + foreach my $file (split $splitRE, $line) { - foreach my $file (split /\s+/, $line) + if ($file ne "") { - if ($file ne "") - { - push @filelist, $file; - } - } - } - else - { - foreach my $file (split /\s+(?=\/)/, $line) - { - if ($file ne "") - { - push @filelist, $file; - } + push @filelist, $file; } } } -- cgit v1.2.3