@@ -983,12 +983,94 @@ private command __extensionLoad pID, pExtensionDataA
983983 revIDEExtensionLoad tSourceType , pID , tFolder , tVersion , tStatus , tError , tIDEExtension , tSourceFile , tToLoadA
984984end __extensionLoad
985985
986+ private command __MapCodeLibraryForIDE pFolder
987+ local tLibraries
988+ if revEnvironmentIsInstalled() and \
989+ pFolder begins with revEnvironmentToolsPath() and \
990+ the platform is "MacOS" then
991+ -- special case bundled extensions must load code from within MacOS dir
992+ -- the libs to load should be in Contents/MacOS/<extension>/
993+ local tExtension
994+ set the itemDelimiter to slash
995+ put item - 2 of pFolder into tExtension
996+
997+ put files (specialFolderPath ("engine" ) & "/" & tExtension ) & return & \
998+ folders (specialFolderPath ("engine" ) & "/" & tExtension ) into tLibraries
999+ filter tLibraries without ".*"
1000+
1001+ if tLibraries is not empty then
1002+ set the itemDelimiter to "."
1003+ repeat for each line tLibrary in tLibraries
1004+ -- remove extension
1005+ delete the last item of tLibrary
1006+ if tLibrary is not empty then
1007+ set the revLibraryMapping[tLibrary ] to "./" & tExtension & "/" & tLibrary
1008+ end if
1009+ end repeat
1010+ end if
1011+ else
1012+ -- code folders should be platform ID triples however for the
1013+ -- time being as we have no way to access the data required to
1014+ -- determine the options section of the platform ID so we filter only
1015+ -- arch and platform and hope for the best. Ideally we would have
1016+ -- access to a build options string and give a complete match precedence.
1017+ local tCodeFolders
1018+ put folders (pFolder ) into tCodeFolders
1019+ switch the platform
1020+ case "MacOS"
1021+ filter tCodeFolders with "*-mac*"
1022+ break
1023+ case "Win32"
1024+ filter tCodeFolders with "*-win*"
1025+ break
1026+ default
1027+ filter tCodeFolders with "*-" & toLower (the platform ) & "*"
1028+ break
1029+ end switch
1030+
1031+ local tFilteredCodeFolders
1032+ filter tCodeFolders with the processor & "-*" into tFilteredCodeFolders
1033+ split tFilteredCodeFolders by return as set
1034+ if the platform is "MacOS" then
1035+ -- explicit processor should take precedence over universal builds but
1036+ -- in the event multiple libraries are included and some are universal
1037+ -- we must merge
1038+ local tUniveralFilteredCodeFolders
1039+ filter tCodeFolders with "universal-*" into tUniveralFilteredCodeFolders
1040+ split tUniveralFilteredCodeFolders by return as set
1041+ union tFilteredCodeFolders with tUniveralFilteredCodeFolders
1042+ end if
1043+
1044+ repeat for each key tFolder in tFilteredCodeFolders
1045+ put files (pFolder & "/" & tFolder ) & return & \
1046+ folders (pFolder & "/" & tFolder ) into tLibraries
1047+ filter tLibraries without ".*"
1048+
1049+ if tLibraries is not empty then
1050+ set the itemDelimiter to "."
1051+ repeat for each line tLibrary in tLibraries
1052+ -- remove extension
1053+ delete the last item of tLibrary
1054+ if tLibrary is not empty then
1055+ set the revLibraryMapping[tLibrary ] to pFolder & "/" & tFolder & "/" & tLibrary
1056+ end if
1057+ end repeat
1058+ end if
1059+ end repeat
1060+ end if
1061+ end __MapCodeLibraryForIDE
1062+
9861063private command __revIDELCBExtensionLoad pID, pFolder, pVersion, pStatus, pError, pIsIDEExtension, pSourceFile, pAdditionalInfoA
9871064 local tStatus , tError
9881065 if pError is empty then
989- local tResources , tModule
1066+ local tResources , tModule , tCode
9901067 put pFolder & slash & "resources" into tResources
9911068 put pFolder & slash & "module.lcm" into tModule
1069+ put pFolder & slash & "code" into tCode
1070+ # map code before loading extension
1071+ if there is a folder tCode then
1072+ __MapCodeLibraryForIDE tCode
1073+ end if
9921074 # If we have a resources folder then load with resource path
9931075 if there is a folder tResources then
9941076 load extension from file tModule with resource path tResources
0 commit comments