From 376524d72c05c80ab2020d571505237bf5293a39 Mon Sep 17 00:00:00 2001 From: Laurent Goderre Date: Thu, 26 Sep 2013 17:41:53 -0400 Subject: [PATCH] Added safer path handling for Windows --- sass.js | 5 +++-- test/cli.js | 6 +++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/sass.js b/sass.js index b24f4e4e2..0a39ce6ab 100644 --- a/sass.js +++ b/sass.js @@ -1,5 +1,6 @@ var binding; var fs = require('fs'); +var path = require('path'); try { if (fs.realpathSync(__dirname + '/build')) { // use the build version if it exists @@ -63,11 +64,11 @@ exports.render = function(options) { options.error = options.error || function(){}; if (options.file !== undefined && options.file !== null) { - return binding.renderFile(options.file, options.success, options.error, newOptions.paths.join(':'), newOptions.style, newOptions.comments); + return binding.renderFile(options.file, options.success, options.error, newOptions.paths.join(path.delimiter), newOptions.style, newOptions.comments); } //Assume data is present if file is not. binding/libsass will tell the user otherwise! - return binding.render(options.data, options.success, options.error, newOptions.paths.join(":"), newOptions.style); + return binding.render(options.data, options.success, options.error, newOptions.paths.join(path.delimiter), newOptions.style); }; exports.renderSync = function(options) { diff --git a/test/cli.js b/test/cli.js index 9432ae362..ce9177781 100644 --- a/test/cli.js +++ b/test/cli.js @@ -62,9 +62,9 @@ describe('cli', function() { it('should compile with --include-path option', function(done){ var emitter = cli([ - '--include-path', __dirname + '/lib', - '--include-path', __dirname + '/functions', - __dirname + '/include_path.scss' + '--include-path', path.join(__dirname, '/lib'), + '--include-path', path.join(__dirname, '/functions'), + path.join(__dirname, '/include_path.scss') ]); emitter.on('error', done); emitter.on('render', function(css){