Permalink
Browse files

path.exists* => fs.exists*

  • Loading branch information...
mjackson committed Aug 18, 2012
1 parent c605d02 commit d37a1585f8b5bf3d600bdc7dc3f7ffdd52309cc5
Showing with 9 additions and 8 deletions.
  1. +2 −1 doc/12_rewriting_urls.js
  2. +3 −3 lib/directory.js
  3. +3 −3 lib/file.js
  4. +1 −1 lib/multipart/parser.js
View
@@ -38,6 +38,7 @@ The example app below performs the same function in Strata.
*/
var path = require("path");
+var fs = require("fs");
var strata = require("strata");
// For the sake of this example, the root directory where we store static files
@@ -51,7 +52,7 @@ function checkHtml(app, root) {
var pathInfo = env.pathInfo;
// Check to see if an .html version of the requested file exists.
- path.exists(path.join(root, pathInfo) + ".html", function (exists) {
+ fs.exists(path.join(root, pathInfo) + ".html", function (exists) {
if (exists) {
// Rewrite env.pathInfo for downstream apps.
env.pathInfo = pathInfo + ".html";
View
@@ -14,7 +14,7 @@ module.exports = function (app, root) {
throw new strata.Error("Invalid root directory");
}
- if (!path.existsSync(root)) {
+ if (!fs.existsSync(root)) {
throw new strata.Error('Directory "' + root + '" does not exist');
}
@@ -33,7 +33,7 @@ module.exports = function (app, root) {
var dir = path.join(root, pathInfo);
- path.exists(dir, function (exists) {
+ fs.exists(dir, function (exists) {
if (exists) {
fs.stat(dir, function (err, stats) {
if (err && strata.handleError(err, env, callback)) {
@@ -106,7 +106,7 @@ function generateListing(env, callback, root, pathInfo, scriptName) {
}
files.forEach(function (file, index) {
- if (!path.existsSync(path.join(dir, file))) {
+ if (!fs.existsSync(path.join(dir, file))) {
return; // Ignore broken symlinks!
}
View
@@ -19,7 +19,7 @@ module.exports = function (app, root, index) {
throw new strata.Error("Invalid root directory");
}
- if (!path.existsSync(root)) {
+ if (!fs.existsSync(root)) {
throw new strata.Error('Directory "' + root + '" does not exist');
}
@@ -46,7 +46,7 @@ module.exports = function (app, root, index) {
var fullPath = path.join(root, pathInfo);
- path.exists(fullPath, function (exists) {
+ fs.exists(fullPath, function (exists) {
if (!exists) {
app(env, callback);
return;
@@ -93,7 +93,7 @@ module.exports = function (app, root, index) {
for (var i = 0, len = index.length; i < len; ++i) {
(function (indexPath) {
- path.exists(indexPath, function (exists) {
+ fs.exists(indexPath, function (exists) {
indexExists[indexPath] = exists;
checked += 1;
View
@@ -41,7 +41,7 @@ function Parser(boundary, tmpdir, prefix) {
tmpdir = tmpdir || "/tmp";
prefix = prefix || "";
- if (!path.existsSync(tmpdir)) {
+ if (!fs.existsSync(tmpdir)) {
throw new strata.Error('Temporary directory "' + tmpdir + '" does not exist');
}

0 comments on commit d37a158

Please sign in to comment.