mirror of
https://codeberg.org/TicklishHoneyBee/CLIte.git
synced 2026-03-11 09:04:37 +00:00
should not be able to cd into a file
This commit is contained in:
parent
45b03465c3
commit
221599955a
1 changed files with 7 additions and 3 deletions
|
|
@ -1317,11 +1317,15 @@ clite.shell = {
|
|||
if (args.length > 1) {
|
||||
dir = clite.lib.resolvePath(args[1]);
|
||||
}
|
||||
var fd = clite.io.open(dir);
|
||||
var fd = clite.io.open(dir,false);
|
||||
if (!fd) {
|
||||
io.error('invalid directory: '+dir);
|
||||
return;
|
||||
}
|
||||
if (!fd.node.data.isdir) {
|
||||
io.error('invalid directory: '+dir);
|
||||
return;
|
||||
}
|
||||
clite.io.close(fd);
|
||||
clite.shell.env.PWD = dir;
|
||||
clite.shell.prompt.generate();
|
||||
|
|
@ -1341,7 +1345,7 @@ clite.shell = {
|
|||
return;
|
||||
}else{
|
||||
var path = clite.shell.resolvePath(args[1]);
|
||||
var fd = clite.io.open(path);
|
||||
var fd = clite.io.open(path,false);
|
||||
if (!fd)
|
||||
return;
|
||||
clite.io.close(fd);
|
||||
|
|
@ -1355,7 +1359,7 @@ clite.shell = {
|
|||
io.write(args[1]+' is a shell builtin');
|
||||
}else{
|
||||
var path = clite.shell.resolvePath(args[1]);
|
||||
var fd = clite.io.open(path);
|
||||
var fd = clite.io.open(path,false);
|
||||
if (!fd)
|
||||
return;
|
||||
clite.io.close(fd);
|
||||
|
|
|
|||
Loading…
Reference in a new issue