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/mv.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/mv.js')
| -rwxr-xr-x | cordova/node_modules/shelljs/src/mv.js | 80 |
1 files changed, 0 insertions, 80 deletions
diff --git a/cordova/node_modules/shelljs/src/mv.js b/cordova/node_modules/shelljs/src/mv.js deleted file mode 100755 index 11f9607..0000000 --- a/cordova/node_modules/shelljs/src/mv.js +++ /dev/null @@ -1,80 +0,0 @@ -var fs = require('fs'); -var path = require('path'); -var common = require('./common'); - -//@ -//@ ### mv(source [, source ...], dest') -//@ ### mv(source_array, dest') -//@ Available options: -//@ -//@ + `f`: force -//@ -//@ Examples: -//@ -//@ ```javascript -//@ mv('-f', 'file', 'dir/'); -//@ mv('file1', 'file2', 'dir/'); -//@ mv(['file1', 'file2'], 'dir/'); // same as above -//@ ``` -//@ -//@ Moves files. The wildcard `*` is accepted. -function _mv(options, sources, dest) { - options = common.parseOptions(options, { - 'f': 'force' - }); - - // Get sources, dest - if (arguments.length < 3) { - common.error('missing <source> and/or <dest>'); - } else if (arguments.length > 3) { - sources = [].slice.call(arguments, 1, arguments.length - 1); - dest = arguments[arguments.length - 1]; - } else if (typeof sources === 'string') { - sources = [sources]; - } else if ('length' in sources) { - sources = sources; // no-op for array - } else { - common.error('invalid arguments'); - } - - sources = common.expand(sources); - - var exists = fs.existsSync(dest), - stats = exists && fs.statSync(dest); - - // Dest is not existing dir, but multiple sources given - if ((!exists || !stats.isDirectory()) && sources.length > 1) - common.error('dest is not a directory (too many sources)'); - - // Dest is an existing file, but no -f given - if (exists && stats.isFile() && !options.force) - common.error('dest file already exists: ' + dest); - - sources.forEach(function(src) { - if (!fs.existsSync(src)) { - common.error('no such file or directory: '+src, true); - return; // skip file - } - - // If here, src exists - - // When copying to '/path/dir': - // thisDest = '/path/dir/file1' - var thisDest = dest; - if (fs.existsSync(dest) && fs.statSync(dest).isDirectory()) - thisDest = path.normalize(dest + '/' + path.basename(src)); - - if (fs.existsSync(thisDest) && !options.force) { - common.error('dest file already exists: ' + thisDest, true); - return; // skip file - } - - if (path.resolve(src) === path.dirname(path.resolve(thisDest))) { - common.error('cannot move to self: '+src, true); - return; // skip file - } - - fs.renameSync(src, thisDest); - }); // forEach(src) -} // mv -module.exports = _mv; |
