diff options
| author | Kumar Priyansh <[email protected]> | 2020-01-03 18:34:23 +0530 |
|---|---|---|
| committer | Kumar Priyansh <[email protected]> | 2020-01-03 18:34:23 +0530 |
| commit | c3373becc9a1393b2e03c8cd6c154601481a60dd (patch) | |
| tree | a8a31f613aef864d8d481ed57dc2c97490dfd328 /cordova/node_modules/shelljs/src/mkdir.js | |
| parent | 2917c8eda330a126b530dd83573670cbc98a4206 (diff) | |
| download | WeatherApp-c3373becc9a1393b2e03c8cd6c154601481a60dd.tar.xz WeatherApp-c3373becc9a1393b2e03c8cd6c154601481a60dd.zip | |
Rewriting the app from scratch with Swift 5
Diffstat (limited to 'cordova/node_modules/shelljs/src/mkdir.js')
| -rwxr-xr-x | cordova/node_modules/shelljs/src/mkdir.js | 68 |
1 files changed, 0 insertions, 68 deletions
diff --git a/cordova/node_modules/shelljs/src/mkdir.js b/cordova/node_modules/shelljs/src/mkdir.js deleted file mode 100755 index 5a7088f..0000000 --- a/cordova/node_modules/shelljs/src/mkdir.js +++ /dev/null @@ -1,68 +0,0 @@ -var common = require('./common'); -var fs = require('fs'); -var path = require('path'); - -// Recursively creates 'dir' -function mkdirSyncRecursive(dir) { - var baseDir = path.dirname(dir); - - // Base dir exists, no recursion necessary - if (fs.existsSync(baseDir)) { - fs.mkdirSync(dir, parseInt('0777', 8)); - return; - } - - // Base dir does not exist, go recursive - mkdirSyncRecursive(baseDir); - - // Base dir created, can create dir - fs.mkdirSync(dir, parseInt('0777', 8)); -} - -//@ -//@ ### mkdir([options ,] dir [, dir ...]) -//@ ### mkdir([options ,] dir_array) -//@ Available options: -//@ -//@ + `p`: full path (will create intermediate dirs if necessary) -//@ -//@ Examples: -//@ -//@ ```javascript -//@ mkdir('-p', '/tmp/a/b/c/d', '/tmp/e/f/g'); -//@ mkdir('-p', ['/tmp/a/b/c/d', '/tmp/e/f/g']); // same as above -//@ ``` -//@ -//@ Creates directories. -function _mkdir(options, dirs) { - options = common.parseOptions(options, { - 'p': 'fullpath' - }); - if (!dirs) - common.error('no paths given'); - - if (typeof dirs === 'string') - dirs = [].slice.call(arguments, 1); - // if it's array leave it as it is - - dirs.forEach(function(dir) { - if (fs.existsSync(dir)) { - if (!options.fullpath) - common.error('path already exists: ' + dir, true); - return; // skip dir - } - - // Base dir does not exist, and no -p option given - var baseDir = path.dirname(dir); - if (!fs.existsSync(baseDir) && !options.fullpath) { - common.error('no such file or directory: ' + baseDir, true); - return; // skip dir - } - - if (options.fullpath) - mkdirSyncRecursive(dir); - else - fs.mkdirSync(dir, parseInt('0777', 8)); - }); -} // mkdir -module.exports = _mkdir; |
