Skip to content

Commit

Permalink
Update LKG
Browse files Browse the repository at this point in the history
  • Loading branch information
ivogabe committed Aug 18, 2015
1 parent 71bc975 commit e1733ef
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions release/host.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,43 @@ var Host = (function () {
Host.prototype.getDefaultLibFileName = function () {
return '__lib.d.ts';
};
Host.prototype.fileExists = function (fileName) {
if (fileName === '__lib.d.ts') {
return true;
}
var sourceFile = this.input.getFile(fileName);
if (sourceFile)
return true;
if (this.externalResolve) {
try {
var stat = fs.statSync(fileName);
if (!stat)
return false;
return stat.isFile();
}
catch (ex) {
}
}
return false;
};
Host.prototype.readFile = function (fileName) {
var normalizedFileName = utils.normalizePath(fileName);
var sourceFile = this.input.getFile(fileName);
if (sourceFile)
return sourceFile.content;
if (this.externalResolve) {
// Read the whole file (and cache contents) to prevent race conditions.
var text;
try {
text = fs.readFileSync(fileName).toString('utf8');
}
catch (ex) {
return undefined;
}
return text;
}
return undefined;
};
Host.libDefault = {};
return Host;
})();
Expand Down

0 comments on commit e1733ef

Please sign in to comment.