Fix @import file loading routine

Again, old fs.open syntax is deprecated, replaced with fs.readFile.
This commit is contained in:
Felix Geisendörfer 2010-10-05 16:59:05 +08:00 committed by Alexis Sellier
parent 8e846a3b11
commit ef71bb0db2

View File

@ -99,24 +99,16 @@ less.Parser.importer = function (file, paths, callback) {
}
if (pathname) {
fs.stat(pathname, function (e, stats) {
if (e) sys.error(e);
fs.readFile(pathname, 'utf-8', function(e, data) {
if (e) sys.error(e);
fs.open(pathname, process.O_RDONLY, stats.mode, function (e, fd) {
if (e) sys.error(e);
fs.read(fd, stats.size, 0, "utf8", function (e, data) {
if (e) sys.error(e);
new(less.Parser)({
paths: [path.dirname(pathname)],
filename: pathname
}).parse(data, function (e, root) {
if (e) less.writeError(e);
callback(root);
});
});
});
new(less.Parser)({
paths: [path.dirname(pathname)],
filename: pathname
}).parse(data, function (e, root) {
if (e) less.writeError(e);
callback(root);
});
});
} else {
sys.error("file '" + file + "' wasn't found.\n");