[Groonga-commit] groonga/gcs-console [master] Node 1.6 doesn't have fs.existsSync

Back to archive index

Yoji SHIDARA null+****@clear*****
Wed Dec 5 12:47:10 JST 2012


Yoji SHIDARA	2012-12-05 12:47:10 +0900 (Wed, 05 Dec 2012)

  New Revision: d5bcaee5ab4e0438556d76ca9d309f6c8bfa3946
  https://github.com/groonga/gcs-console/commit/d5bcaee5ab4e0438556d76ca9d309f6c8bfa3946

  Log:
    Node 1.6 doesn't have fs.existsSync

  Modified files:
    lib/config.js

  Modified: lib/config.js (+2 -1)
===================================================================
--- lib/config.js    2012-12-05 12:37:14 +0900 (f3b24e4)
+++ lib/config.js    2012-12-05 12:47:10 +0900 (8228aed)
@@ -1,5 +1,6 @@
 var fs = require('fs');
 var mkdirp = require('mkdirp');
+var existsSync = fs.existsSync || path.existsSync; // to support older nodes than 0.8
 
 var CONFIG_FILE_NAME = 'config.json';
 var Config = function(home) {
@@ -14,7 +15,7 @@ Config.prototype = {
     return this.home + '/' + CONFIG_FILE_NAME;
   },
   load: function() {
-    if (fs.existsSync(this.configFilePath())) {
+    if (existsSync(this.configFilePath())) {
       this.data = JSON.parse(fs.readFileSync(this.configFilePath()));
     }
   },
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Back to archive index