From 47c404f823b124391ebf1475362185fe367f6bdc Mon Sep 17 00:00:00 2001 From: Allan Guigou Date: Thu, 24 Dec 2020 12:57:49 -0500 Subject: [PATCH] Allow a gadget to specify a custom extension path When installing a custom gadget not officially supported by vimspector the default extension path is 'extension', this works for vscode extensions but does not support some debug adapters. This commit gives the ability to change that default extension path by specifying 'extension_path' within the gadget installer file. Installing 'cust_adapter' would use the extension path 'adapter' rather than 'extension' (ie ${gadgetDir}/cust_adapter/${version}/root/adapter) { "cust_adapter": { "download": { ... }, "all": { "extension_path": "adapter", "adapters": { ... } } } } --- python3/vimspector/installer.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/python3/vimspector/installer.py b/python3/vimspector/installer.py index b39398f..46a9e69 100644 --- a/python3/vimspector/installer.py +++ b/python3/vimspector/installer.py @@ -340,11 +340,12 @@ def WriteAdapters( all_adapters, to_file=None ): def InstallGeneric( name, root, gadget ): - extension = os.path.join( root, 'extension' ) + extension_path = gadget.get( 'extension_path', 'extension' ) + extension = os.path.join( root, extension_path ) for f in gadget.get( 'make_executable', [] ): MakeExecutable( os.path.join( extension, f ) ) - MakeExtensionSymlink( name, root ) + MakeExtensionSymlink( name, root, extension_path ) def InstallCppTools( name, root, gadget ): @@ -699,8 +700,8 @@ def ExtractZipTo( file_path, destination, format ): CheckCall( [ 'tar', 'zxvf', file_path ] ) -def MakeExtensionSymlink( name, root ): - MakeSymlink( name, os.path.join( root, 'extension' ) ), +def MakeExtensionSymlink( name, root, extension_path = 'extension' ): + MakeSymlink( name, os.path.join( root, extension_path ) ), def MakeSymlink( link, pointing_to, in_folder = None ):