Skip to content

Commit

Permalink
Ensure launchingFile exists when setting working directory (#6577)
Browse files Browse the repository at this point in the history
  • Loading branch information
joyceerhl authored Jul 8, 2021
1 parent df566d7 commit 14d5a86
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/client/datascience/jupyter/jupyterNotebook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -964,7 +964,11 @@ export class JupyterNotebookBase implements INotebook {
// We should use the launch info directory. It trumps the possible dir
this._workingDirectory = suggested;
return this.changeDirectoryIfPossible(this._workingDirectory);
} else if (launchingFile && (await this.fs.localDirectoryExists(path.dirname(launchingFile)))) {
} else if (
launchingFile &&
(await this.fs.localFileExists(launchingFile)) &&
(await this.fs.localDirectoryExists(path.dirname(launchingFile)))
) {
// Combine the working directory with this file if possible.
this._workingDirectory = expandWorkingDir(
this._executionInfo.workingDir,
Expand Down

0 comments on commit 14d5a86

Please sign in to comment.