Commit a3c1124c by Andrew Nesbitt

Merge pull request #159 from LaurentGoderre/add-safer-path-handling

Added safer path handling for Windows
parents a253ed1f 376524d7
var binding; var binding;
var fs = require('fs'); var fs = require('fs');
var path = require('path');
try { try {
if (fs.realpathSync(__dirname + '/build')) { if (fs.realpathSync(__dirname + '/build')) {
// use the build version if it exists // use the build version if it exists
...@@ -63,11 +64,11 @@ exports.render = function(options) { ...@@ -63,11 +64,11 @@ exports.render = function(options) {
options.error = options.error || function(){}; options.error = options.error || function(){};
if (options.file !== undefined && options.file !== null) { 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! //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) { exports.renderSync = function(options) {
......
...@@ -62,9 +62,9 @@ describe('cli', function() { ...@@ -62,9 +62,9 @@ describe('cli', function() {
it('should compile with --include-path option', function(done){ it('should compile with --include-path option', function(done){
var emitter = cli([ var emitter = cli([
'--include-path', __dirname + '/lib', '--include-path', path.join(__dirname, '/lib'),
'--include-path', __dirname + '/functions', '--include-path', path.join(__dirname, '/functions'),
__dirname + '/include_path.scss' path.join(__dirname, '/include_path.scss')
]); ]);
emitter.on('error', done); emitter.on('error', done);
emitter.on('render', function(css){ emitter.on('render', function(css){
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment