var utils = require('../utils')
, extname = utils.extname
, dirname = utils.dirname
, basename = utils.basename
, fs = require('fs');
, fs = require('fs')
, stat = fs.statSync;
/**
* Memory cache.
*/
this.dirname = dirname(this.path);
};
/**
* Check if the view path exists.
*
* @return {Boolean}
* @api public
*/
View.prototype.exists = function(){
try {
stat(this.path);
return true;
} catch (err) {
return false;
}
};
/**
* Resolve view engine.
*
* @return {String}
* @api private
return cache[ext] || (cache[ext] = require(this.engine));
});
/**
* Return index path alternative.
*
* @return {String}
* @api public
*/
View.prototype.__defineGetter__('indexPath', function(){
return this.dirname
+ '/' + this.basename.replace(this.extension, '')
+ '/index' + this.extension;
});
/**
* Register the given template engine `exports`
* as `ext`. For example we may wish to map ".html"
* files to jade:
*