@@ -2,15 +2,16 @@ var assert = require("assert");
22var path = require ( "path" ) ;
33var fs = require ( "fs" ) ;
44var Store = require ( "connect/lib/middleware/session/store" ) ;
5+ var exists = fs . existsSync || path . existsSync ;
56
67module . exports = function startup ( options , imports , register ) {
78
89 assert ( options . sessionsPath , "option 'sessionsPath' is required" ) ;
910
10- if ( ! path . existsSync ( path . dirname ( options . sessionsPath ) ) ) {
11+ if ( ! exists ( path . dirname ( options . sessionsPath ) ) ) {
1112 fs . mkdir ( path . dirname ( options . sessionsPath ) , 0755 ) ;
1213 }
13- if ( ! path . existsSync ( options . sessionsPath ) ) {
14+ if ( ! exists ( options . sessionsPath ) ) {
1415 fs . mkdir ( options . sessionsPath , 0755 ) ;
1516 }
1617
@@ -69,7 +70,8 @@ FileStore.prototype.__proto__ = Store.prototype;
6970
7071FileStore . prototype . get = function ( sid , fn ) {
7172 var self = this ;
72- path . exists ( self . basePath + "/" + sid , function ( exists ) {
73+ var exists = fs . exists || path . exists ;
74+ exists ( self . basePath + "/" + sid , function ( exists ) {
7375 if ( exists ) {
7476 fs . readFile ( self . basePath + "/" + sid , function ( err , data ) {
7577 if ( err ) {
@@ -117,7 +119,8 @@ FileStore.prototype.set = function(sid, sess, fn){
117119
118120FileStore . prototype . destroy = function ( sid , fn ) {
119121 var self = this ;
120- path . exists ( self . basePath + "/" + sid , function ( exists ) {
122+ var exists = fs . exists || path . exists ;
123+ exists ( self . basePath + "/" + sid , function ( exists ) {
121124 if ( exists ) {
122125 fs . unlink ( self . basePath + "/" + sid , function ( err ) {
123126 if ( err ) {
0 commit comments