Skip to content

Commit bb6ebe5

Browse files
committed
Handle query directory not existing
Also, fix some changelog notes.
1 parent 71aa3d1 commit bb6ebe5

2 files changed

Lines changed: 11 additions & 2 deletions

File tree

extensions/ql-vscode/CHANGELOG.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
## [UNRELEASED]
44

55
- Fix a bug where the AST viewer was not synchronizing its selected node when the editor selection changes. [#1230](https://github.com/github/vscode-codeql/pull/1230)
6-
- Open the directory in the finder/explorer (instead of just highlighting it) when running the command "Open query directory" command from the query history view. [#1235](https://github.com/github/vscode-codeql/pull/1235)
7-
- Ensure query label changes are persisted across restarts. [#1235](https://github.com/github/vscode-codeql/pull/1235)
6+
- Open the directory in the finder/explorer (instead of just highlighting it) when running the "Open query directory" command from the query history view. [#1235](https://github.com/github/vscode-codeql/pull/1235)
7+
- Ensure query label in the query history view changes are persisted across restarts. [#1235](https://github.com/github/vscode-codeql/pull/1235)
88

99
## 1.6.1 - 17 March 2022
1010

extensions/ql-vscode/src/query-history.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import * as path from 'path';
2+
import * as fs from 'fs-extra';
23
import {
34
commands,
45
Disposable,
@@ -747,6 +748,14 @@ export class QueryHistoryManager extends DisposableObject {
747748
}
748749

749750
if (externalFilePath) {
751+
if (!(await fs.pathExists(externalFilePath))) {
752+
// timestamp file is missing (manually deleted?) try selecting the parent folder.
753+
// It's less nice, but at least it will work.
754+
externalFilePath = path.dirname(externalFilePath);
755+
if (!(await fs.pathExists(externalFilePath))) {
756+
throw new Error(`Query directory does not exist: ${externalFilePath}`);
757+
}
758+
}
750759
try {
751760
await commands.executeCommand('revealFileInOS', Uri.file(externalFilePath));
752761
} catch (e) {

0 commit comments

Comments
 (0)