diff options
Diffstat (limited to 'modules/core/module-fs.js')
| -rw-r--r-- | modules/core/module-fs.js | 28 |
1 files changed, 4 insertions, 24 deletions
diff --git a/modules/core/module-fs.js b/modules/core/module-fs.js index ae8b5f4..da2e740 100644 --- a/modules/core/module-fs.js +++ b/modules/core/module-fs.js @@ -148,37 +148,17 @@ class FileSystemModule { }; this.commands['mv'] = (args) => { if(!args[0] || !args[1]) return this.terminal.print('Usage: mv <source> <dest>', 'warning'); - const srcDir = this.terminal.fs.readDir(args[0]); - if (srcDir !== null) { - if (this.terminal.fs.moveDir(args[0], args[1])) { - this.terminal.print('Moved directory: ' + args[0] + ' to ' + args[1], 'success'); - } else { - this.terminal.print('mv: ' + args[0] + ': failed to move directory', 'error'); - } - return; - } - if (this.terminal.fs.moveFile(args[0], args[1])) { + if (this.terminal.fs.mv(args[0], args[1])) this.terminal.print('Moved: ' + args[0] + ' to ' + args[1], 'success'); - } else { + else this.terminal.print('mv: ' + args[0] + ': No such file or directory', 'error'); - } }; this.commands['cp'] = (args) => { if(!args[0] || !args[1]) return this.terminal.print('Usage: cp <source> <dest>', 'warning'); - const srcDir = this.terminal.fs.readDir(args[0]); - if (srcDir !== null) { - if (this.terminal.fs.copyDir(args[0], args[1])) { - this.terminal.print('Copied directory: ' + args[0] + ' to ' + args[1], 'success'); - } else { - this.terminal.print('cp: ' + args[0] + ': failed to copy directory', 'error'); - } - return; - } - if (this.terminal.fs.copyFile(args[0], args[1])) { + if (this.terminal.fs.cp(args[0], args[1])) this.terminal.print('Copied: ' + args[0] + ' to ' + args[1], 'success'); - } else { + else this.terminal.print('cp: ' + args[0] + ': No such file or directory', 'error'); - } }; this.commands['cd'] = (args) => { if (!args[0] || args[0] === '/') { |