From 5cbac2019a1d59698e8acc63672f5d94e090f840 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C5=A9ng=20Nguy=E1=BB=85n?= Date: Sat, 22 Aug 2015 15:40:31 +0700 Subject: [PATCH] Support pre input -i with % in Windows OS Example: $process->addPreInputCommand('-i', $example_images_dir."P1110%d.jpg"); --- src/PHPVideoToolkit/ProcessBuilder.php | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/PHPVideoToolkit/ProcessBuilder.php b/src/PHPVideoToolkit/ProcessBuilder.php index c18140c..bde9a11 100644 --- a/src/PHPVideoToolkit/ProcessBuilder.php +++ b/src/PHPVideoToolkit/ProcessBuilder.php @@ -148,11 +148,20 @@ protected function _combineArgumentList($commands) if(empty($commands) === false) { - foreach ($commands as $argument) - { - // the array ois a flag for a raw argument - $command_string .= (is_array($argument) === true ? $argument : escapeshellarg($argument)).' '; - } + // Is windows? + if(strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') { + foreach ($commands as $argument) + { + $command_string .= (is_array($argument) === true ? $argument : str_replace("===NXBYPASS===", "%", escapeshellarg(str_replace("%", "===NXBYPASS===", $argument)))).' '; + } + } else { + foreach ($commands as $argument) + { + // the array ois a flag for a raw argument + + $command_string .= (is_array($argument) === true ? $argument : escapeshellarg($argument)).' '; + } + } } return trim($command_string);