Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[Finder] Fixed filename containing space bug in gnu adapter.
  • Loading branch information
jfsimon committed Oct 29, 2012
1 parent 9bf7cb0 commit 2817a47
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/Symfony/Component/Finder/Adapter/GnuFindAdapter.php
Expand Up @@ -84,7 +84,7 @@ public function searchInDirectory($dir)
$this->buildDatesFiltering($find, $this->dates);

$useGrep = $this->shell->testCommand('grep') && $this->shell->testCommand('xargs');
$useSort = is_int($this->sort) && $this->shell->testCommand('sort') && $this->shell->testCommand('awk');
$useSort = is_int($this->sort) && $this->shell->testCommand('sort') && $this->shell->testCommand('cut');

if ($useGrep && ($this->contains || $this->notContains)) {
$grep = $command->ins('grep');
Expand Down Expand Up @@ -286,8 +286,8 @@ private function buildSorting(Command $command, $sort)
{
switch ($sort) {
case SortableIterator::SORT_BY_NAME:
$format = null;
break;
$command->ins('sort')->add('| sort');
return;
case SortableIterator::SORT_BY_TYPE:
$format = '%y';
break;
Expand All @@ -306,6 +306,6 @@ private function buildSorting(Command $command, $sort)

$command->get('find')->add('-printf')->arg($format.' %h/%f\\n');
$command->ins('sort')->add('| sort');
$command->ins('awk')->add('| awk')->arg('{ print $'.(null === $format ? '1' : '2').' }');
$command->ins('awk')->add('| cut')->arg('-d ')->arg('-f2-');
}
}

0 comments on commit 2817a47

Please sign in to comment.