Skip to content

Commit 991f2f4

Browse files
committed
Use 'tmp' to create temporary directory
1 parent 65695c3 commit 991f2f4

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

extensions/ql-vscode/src/extension.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import {
1616
import { LanguageClient } from 'vscode-languageclient';
1717
import * as os from 'os';
1818
import * as path from 'path';
19+
import * as tmp from 'tmp';
1920
import { testExplorerExtensionId, TestHub } from 'vscode-test-adapter-api';
2021

2122
import { AstViewer } from './astViewer';
@@ -498,11 +499,15 @@ async function activateWithInstalledDistribution(
498499
): Promise<void> {
499500
const path = selectedQuery ? selectedQuery.path : window.activeTextEditor!.document.uri.fsPath;
500501
if(path) {
502+
/*
501503
// Get path of temporary 'qh-markdown' directory in extension context
502-
const tempDirPath = `${getContextStoragePath(ctx)}/qh-markdown/`;
504+
const tempDirPath = `${getContextStoragePath(ctx)}/qh-markdown/`;
505+
*/
506+
// Create temporary directory
507+
const tmpDir = tmp.dirSync();
503508
// Get library name and query file name in the format 'libname/queryname.md
504509
const mdFilePath = path.split('/').slice(-2).join('/').replace('.qhelp', '.md');
505-
const absolutePathToMd = `${tempDirPath}${mdFilePath}`;
510+
const absolutePathToMd = `${tmpDir.name}${mdFilePath}`;
506511
const uri = Uri.file(absolutePathToMd);
507512
try {
508513
await cliServer.generateQueryHelp(path , 'markdown', absolutePathToMd);

0 commit comments

Comments
 (0)