MCPcopy Create free account
hub / github.com/deepnote/vscode-deepnote / getExtensionTempDir

Function getExtensionTempDir

src/platform/common/temp.ts:16–36  ·  view source on GitHub ↗
(context: IExtensionContext, fs?: IFileSystem)

Source from the content-addressed store, hash-verified

14}
15
16export async function getExtensionTempDir(context: IExtensionContext, fs?: IFileSystem): Promise<Uri> {
17 if (isWeb()) {
18 return Uri.joinPath(context.globalStorageUri, getCurrentTempDirName(context));
19 } else {
20 // Ensure we use the file scheme when dealing with the desktop version of VS Code.
21 // eslint-disable-next-line local-rules/dont-use-fspath
22 let dir = Uri.joinPath(Uri.file(context.globalStorageUri.fsPath), getCurrentTempDirName(context));
23 if (fs) {
24 // Verify we can create this directory, this ensures the fact taht the user has permissions in this dir.
25 try {
26 await fs.createDirectory(dir);
27 } catch (ex) {
28 // eslint-disable-next-line local-rules/dont-use-fspath
29 logger.warn(`Failed to create temp directory (${dir.fsPath}), falling back to extension dir`, ex);
30 dir = Uri.joinPath(context.extensionUri, 'temp');
31 await fs.createDirectory(dir);
32 }
33 }
34 return dir;
35 }
36}
37
38export async function deleteTempDirs(context: IExtensionContext) {
39 try {

Callers 3

initializeLoggersFunction · 0.90
getRuntimeDirMethod · 0.90

Calls 6

isWebFunction · 0.90
getCurrentTempDirNameFunction · 0.85
joinPathMethod · 0.65
createDirectoryMethod · 0.65
warnMethod · 0.65
fileMethod · 0.45

Tested by

no test coverage detected