mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 02:35:49 +00:00
feature(cloudcmd) root: add directory check
This commit is contained in:
parent
092892289c
commit
6310fc7fd1
1 changed files with 10 additions and 4 deletions
|
|
@ -143,17 +143,23 @@
|
|||
}
|
||||
|
||||
function root(dir) {
|
||||
var current;
|
||||
var current,
|
||||
fs = require('fs');
|
||||
|
||||
if (!dir) {
|
||||
current = config('root');
|
||||
current = config('root') || '/';
|
||||
} else {
|
||||
current = dir;
|
||||
config('root', dir);
|
||||
}
|
||||
|
||||
if (current && current !== '/')
|
||||
console.log('root:', dir);
|
||||
fs.stat(current, function(error) {
|
||||
if (error)
|
||||
exit('cloudcmd --root: %s', error.message);
|
||||
else if (current !== '/')
|
||||
console.log('root:', dir);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function repl() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue