You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
634 B
23 lines
634 B
define(["dojo/has!host-node?./node/fs:./rhino/fs"], function(result){ |
|
// Code to strip BOM |
|
var origReadFileSync = result.readFileSync; |
|
result.readFileSync = function(filename, encoding) { |
|
var text = origReadFileSync(filename, encoding); |
|
if(encoding == "utf8"){ |
|
text = text.replace(/^\uFEFF/, ''); // remove BOM |
|
} |
|
return text; |
|
}; |
|
|
|
var origReadFile = result.readFile; |
|
result.readFile = function(filename, encoding, cb){ |
|
origReadFile(filename, encoding, function(err, text){ |
|
if(text && encoding == "utf8"){ |
|
text = text.replace(/^\uFEFF/, ''); // remove BOM |
|
} |
|
cb(err, text); |
|
}); |
|
}; |
|
|
|
return result; |
|
});
|
|
|