Prevent changing cwd to a file

Fixes #110.
This commit is contained in:
Florine W. Dekker 2020-03-18 18:24:10 +01:00
parent 49da5b785a
commit 3daa762571
Signed by: FWDekker
GPG Key ID: B1B567AF58D6EE0F
2 changed files with 2 additions and 2 deletions

View File

@ -1,6 +1,6 @@
{
"name": "fwdekker.com",
"version": "0.28.0",
"version": "0.28.1",
"description": "The source code of [my personal website](https://fwdekker.com/).",
"author": "Felix W. Dekker",
"repository": {

View File

@ -365,7 +365,7 @@ export class Commands {
}
const path = Path.interpret(this.environment.get("cwd"), input.args[0]);
if (!this.fileSystem.has(path)) {
if (!this.fileSystem.has(path) || !(this.fileSystem.get(path) instanceof Directory)) {
streams.err.writeLine(`cd: The directory '${path}' does not exist.`);
return -1;
}