-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: use path in user home as extension dir
* Instead of unpacking vsix files to a temporary directory, they are now unpacked to the user extension dir, which is by default <userhome>/.theia/extensions/<extension-id>. This avoids redundant unpacking after the temp directory is deleted. * If the extension is downloaded from a registry, the vsix file is downloaded to a temporary location and unpacked into the user extension dir from there. * The temporary deployment directory is no longer used. This should speed up Theia's start after the temp dir location has been cleaned (e.g., after a reboot). Signed-off-by: Olaf Lessenich <[email protected]>
- Loading branch information
Showing
5 changed files
with
81 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
packages/plugin-ext-vscode/src/node/plugin-vscode-decompress.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// ***************************************************************************** | ||
// Copyright (C) 2023 EclipseSource and others. | ||
// | ||
// This program and the accompanying materials are made available under the | ||
// terms of the Eclipse Public License v. 2.0 which is available at | ||
// http://www.eclipse.org/legal/epl-2.0. | ||
// | ||
// This Source Code may also be made available under the following Secondary | ||
// Licenses when the conditions for such availability set forth in the Eclipse | ||
// Public License v. 2.0 are satisfied: GNU General Public License, version 2 | ||
// with the GNU Classpath Exception which is available at | ||
// https://www.gnu.org/software/classpath/license.html. | ||
// | ||
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 | ||
// ***************************************************************************** | ||
|
||
import * as decompress from 'decompress'; | ||
import * as path from 'path'; | ||
import * as fs from '@theia/core/shared/fs-extra'; | ||
|
||
export async function decompressExtension(sourcePath: string, destPath: string): Promise<boolean> { | ||
try { | ||
await decompress(sourcePath, destPath); | ||
if (sourcePath.endsWith('.tgz')) { | ||
const extensionPath = path.join(destPath, 'package'); | ||
const vscodeNodeModulesPath = path.join(extensionPath, 'vscode_node_modules.zip'); | ||
if (await fs.pathExists(vscodeNodeModulesPath)) { | ||
await decompress(vscodeNodeModulesPath, path.join(extensionPath, 'node_modules')); | ||
} | ||
} | ||
return true; | ||
} catch (error) { | ||
console.error(`Failed to decompress ${sourcePath} to ${destPath}: ${error}`); | ||
return false; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters