aboutsummaryrefslogtreecommitdiff
path: root/src/compiler.js
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2012-09-25 17:45:00 -0700
committerAlon Zakai <alonzakai@gmail.com>2012-09-25 17:45:00 -0700
commitc74da50989604747e3174429d0538f668b4ff7e7 (patch)
tree62d9fe9928467a13ce767429a9de029bed38b177 /src/compiler.js
parent7975d7a86be841805e868a4e5c0ae9aae04df03c (diff)
add workaround for older node versions
Diffstat (limited to 'src/compiler.js')
-rw-r--r--src/compiler.js10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/compiler.js b/src/compiler.js
index ab5e6acf..2863afda 100644
--- a/src/compiler.js
+++ b/src/compiler.js
@@ -31,6 +31,16 @@ if (ENVIRONMENT_IS_NODE) {
var nodeFS = require('fs');
var nodePath = require('path');
+ if (!nodeFS.existsSync) {
+ nodeFS.existsSync = function(path) {
+ try {
+ return !!nodeFS.readFileSync(path);
+ } catch(e) {
+ return false;
+ }
+ }
+ }
+
function find(filename) {
var prefixes = [__dirname, process.cwd()];
for (var i = 0; i < prefixes.length; ++i) {