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": { ... }
    }
  }
}
This commit is contained in:
Allan Guigou 2020-12-24 12:57:49 -05:00
commit 47c404f823

View file

@ -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 ):