mirror of
https://github.com/apache/cordova-android.git
synced 2025-03-07 02:31:12 +08:00
20 lines
444 B
JavaScript
20 lines
444 B
JavaScript
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;
|