Skip to content

Commit

Permalink
Hunspell: fix Windows compatibility (#11)
Browse files Browse the repository at this point in the history
On Windows, all paths contain a colon (`:`) and search paths are separated by a semicolon (`;`).

Fixes #10.
  • Loading branch information
caugner authored and icanhazstring committed Jan 18, 2019
1 parent cb7c8bd commit 6e1102f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Hunspell/Hunspell.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,12 @@ public function getSupportedLanguages(): array
$languages = [];

$output = explode(PHP_EOL, $process->getErrorOutput());
$is_win = strtoupper(substr(PHP_OS, 0, 3)) === 'WIN';
foreach ($output as $line) {
$line = trim($line);
if ('' === $line // Skip empty lines
|| substr($line, -1) === ':' // Skip headers
|| strpos($line, ':') !== false // Skip search path
|| strpos($line, $is_win ? ';' : ':') !== false // Skip search path
) {
continue;
}
Expand Down

0 comments on commit 6e1102f

Please sign in to comment.