kriswallsmith/assetic — Issue #178: [Assetic] error with assetic:dump and JAVA path under Windows
Author: FredoVelcro
Created: 2012-02-09 10:44:37+00:00
State: open

Hello,

Plateform : Windows 7 / Symfony 2.0.10

I use YUI filter for assets + Google closure.
Here is my config :

assetic:
debug: %kernel.debug%
use_controller: false
java: C:/Progra~1/Java/jre6/bin/java.exe
filters:
cssrewrite: ~
closure:
jar: %kernel.root_dir%/Resources/java/compiler.jar
#compilationLevel: ADVANCED_OPTIMIZATIONS
yui_css:
jar: %kernel.root_dir%/Resources/java/yuicompressor-2.4.7.jar
yui_js:
jar: %kernel.root_dir%/Resources/java/yuicompressor-2.4.7.jar

When trying :
console assetic:dump ../web

I have got :

[RuntimeException]
La syntaxe du nom de fichier, de répertoire ou de volume est incorrecte.

The only way to make it work is to modify the Assetic Bundle like this :
File : Assetic/Util/ProcessBuilder.php
Method : getProcess() (bugs lines 95,103,110 here commented)

public function getProcess()
{
if (!count($this->arguments)) {
throw new \LogicException('You must add() command arguments before calling getProcess().');
}

$options = $this->options;

//if (defined('PHP_WINDOWS_MAJOR_VERSION')) {
if (defined('PHP_WINDOWS_VERSION_MAJOR')) {
$options += array('bypass_shell' => true);

$args = $this->arguments;
$cmd = array_shift($args);

$script = '"'.$cmd.'"';
if ($args) {
//$script .= ' '.implode(' ', array_map('escapeshellarg', $parts));
$script .= ' '.implode(' ', array_map('escapeshellarg', $args));
}
} else {
$script = implode(' ', array_map('escapeshellarg', $this->arguments));
}
$env = $this->inheritEnv ? ($this->env ?: array()) + $_ENV : $this->env;

//return new Process($script, $this->cwd, $env, $this->stdin, $this->timeout, $options);
return new Process($script, $this->cwd, null, $this->stdin, $this->timeout, $options);
}