aboutsummaryrefslogtreecommitdiff
path: root/cordova/node_modules/shelljs/src/cd.js
diff options
context:
space:
mode:
Diffstat (limited to 'cordova/node_modules/shelljs/src/cd.js')
-rwxr-xr-xcordova/node_modules/shelljs/src/cd.js19
1 files changed, 19 insertions, 0 deletions
diff --git a/cordova/node_modules/shelljs/src/cd.js b/cordova/node_modules/shelljs/src/cd.js
new file mode 100755
index 0000000..230f432
--- /dev/null
+++ b/cordova/node_modules/shelljs/src/cd.js
@@ -0,0 +1,19 @@
+var fs = require('fs');
+var common = require('./common');
+
+//@
+//@ ### cd('dir')
+//@ Changes to directory `dir` for the duration of the script
+function _cd(options, dir) {
+ if (!dir)
+ common.error('directory not specified');
+
+ if (!fs.existsSync(dir))
+ common.error('no such file or directory: ' + dir);
+
+ if (!fs.statSync(dir).isDirectory())
+ common.error('not a directory: ' + dir);
+
+ process.chdir(dir);
+}
+module.exports = _cd;