summaryrefslogtreecommitdiff
path: root/lib/path.js
diff options
context:
space:
mode:
authorMaciej MaƂecki <maciej.malecki@notimplemented.org>2012-01-21 02:37:57 +0100
committerBen Noordhuis <info@bnoordhuis.nl>2012-01-21 14:37:14 +0100
commite10ed097cb3b506009ab28af4dec93402aa48693 (patch)
treee262d6ffe8b9bc20aa2c4fda1e2c85ddec49364a /lib/path.js
parent56e34c2f814905a8fc3329485c64a70d59d8eeba (diff)
downloadandroid-node-v8-e10ed097cb3b506009ab28af4dec93402aa48693.tar.gz
android-node-v8-e10ed097cb3b506009ab28af4dec93402aa48693.tar.bz2
android-node-v8-e10ed097cb3b506009ab28af4dec93402aa48693.zip
path fs: move `path.exists*` to `fs.exists*`
`path.exists*` functions show a deprecation warning and call functions from `fs`. They should be removed later. test: fix references to `path.exists*` in tests test fs: add test for `fs.exists` and `fs.existsSync` doc: reflect moving `path.exists*` to `fs`
Diffstat (limited to 'lib/path.js')
-rw-r--r--lib/path.js14
1 files changed, 5 insertions, 9 deletions
diff --git a/lib/path.js b/lib/path.js
index b70225b1d6..6a744dfeca 100644
--- a/lib/path.js
+++ b/lib/path.js
@@ -21,6 +21,7 @@
var isWindows = process.platform === 'win32';
+var _deprecationWarning = require('util')._deprecationWarning;
// resolves . and .. elements in a path array with directory names there
@@ -402,19 +403,14 @@ exports.extname = function(path) {
exports.exists = function(path, callback) {
- process.binding('fs').stat(path, function(err, stats) {
- if (callback) callback(err ? false : true);
- });
+ _deprecationWarning('path', '`path.exists` is now called `fs.exists`');
+ require('fs').exists(path, callback);
};
exports.existsSync = function(path) {
- try {
- process.binding('fs').stat(path);
- return true;
- } catch (e) {
- return false;
- }
+ _deprecationWarning('path', '`path.exists` is now called `fs.exists`');
+ return require('fs').existsSync(path);
};