Merge pull request #526 from cygmris/master

Add commands support for Windows
This commit is contained in:
Lars Jung
2016-05-27 23:00:26 +02:00

View File

@@ -119,17 +119,17 @@ class Setup {
$cmds = Json::load($cmds_cache_path); $cmds = Json::load($cmds_cache_path);
if (sizeof($cmds) === 0 || $this->refresh) { if (sizeof($cmds) === 0 || $this->refresh) {
$cmds['command'] = Util::exec_0('command -v command'); $cmds['command'] = Util::exec_0('command -v command');
$cmds['which'] = Util::exec_0('which which'); $cmds['which'] = Util::exec_0('which which') ? true : Util::exec_0('which which.exe');
$cmd = false; $cmd = false;
if ($cmds['command']) { if ($cmds['command']) {
$cmd = 'command -v'; $cmd = 'command -v';
} else if ($cmds['which']) { } else if ($cmds['which']) {
$cmd = 'which'; $cmd = 'which ';
} }
foreach (['avconv', 'convert', 'du', 'ffmpeg', 'gm', 'tar', 'zip'] as $c) { foreach (['avconv', 'convert', 'du', 'ffmpeg', 'gm', 'tar', 'zip'] as $c) {
$cmds[$c] = ($cmd !== false) && Util::exec_0($cmd . ' ' . $c); $cmds[$c] = ($cmd !== false) && Util::exec_0($cmd . $c) || Util::exec_0($cmd . $c . '.exe');
} }
Json::save($cmds_cache_path, $cmds); Json::save($cmds_cache_path, $cmds);