2121
2222/**
2323 * @module FrameworkImage
24- * @version 2.5 .0
24+ * @version 2.6 .0
2525 */
2626
2727'use strict' ;
@@ -34,6 +34,7 @@ const Fs = require('fs');
3434const REGEXP_SVG = / ( w i d t h = \" \d + \" ) + | ( h e i g h t = \" \d + \" ) + / g;
3535const REGEXP_PATH = / \/ / g;
3636const REGEXP_ESCAPE = / \' / g;
37+ const D = require ( 'os' ) . platform ( ) . substring ( 0 , 3 ) . toLowerCase ( ) === 'win' ? '"' : '\'' ;
3738
3839var CACHE = { } ;
3940var middlewares = { } ;
@@ -404,7 +405,7 @@ Image.prototype.push = function(key, value, priority, encode) {
404405
405406 if ( value != null ) {
406407 if ( encode && typeof ( value ) === 'string' )
407- cmd += ' \'' + value . replace ( REGEXP_ESCAPE , '' ) + '\'' ;
408+ cmd += ' ' + D + value . replace ( REGEXP_ESCAPE , '' ) + D ;
408409 else
409410 cmd += ' ' + value ;
410411 }
@@ -673,7 +674,7 @@ Image.prototype.sepia = function() {
673674} ;
674675
675676Image . prototype . watermark = function ( filename , x , y , w , h ) {
676- return this . push ( '-draw' , 'image over {1},{2} {3},{4} \'{0}\'' . format ( filename , x || 0 , y || 0 , w || 0 , h || 0 ) , 6 , true ) ;
677+ return this . push ( '-draw' , 'image over {1},{2} {3},{4} {5}{0}{5}' . format ( filename , x || 0 , y || 0 , w || 0 , h || 0 , D ) , 6 , true ) ;
677678} ;
678679
679680Image . prototype . make = function ( fn ) {
@@ -686,7 +687,7 @@ Image.prototype.command = function(key, value, priority, esc) {
686687} ;
687688
688689function wrap ( command , empty ) {
689- return ( empty ? ' ' : '' ) + '\'' + command . replace ( REGEXP_ESCAPE , '' ) + '\'' ;
690+ return ( empty ? ' ' : '' ) + D + command . replace ( REGEXP_ESCAPE , '' ) + D ;
690691}
691692
692693exports . Image = Image ;
0 commit comments