(context: IExtensionContext, fs?: IFileSystem)
| 14 | } |
| 15 | |
| 16 | export 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 | |
| 38 | export async function deleteTempDirs(context: IExtensionContext) { |
| 39 | try { |
no test coverage detected