@@ -1047,12 +1047,94 @@ private command __extensionLoad pID, pExtensionDataA
10471047 tError , tIDEExtension , tSourceFile , tToLoadA , true
10481048end __extensionLoad
10491049
1050+ private command __MapCodeLibraryForIDE pFolder
1051+ local tLibraries
1052+ if revEnvironmentIsInstalled() and \
1053+ pFolder begins with revEnvironmentToolsPath() and \
1054+ the platform is "MacOS" then
1055+ -- special case bundled extensions must load code from within MacOS dir
1056+ -- the libs to load should be in Contents/MacOS/<extension>/
1057+ local tExtension
1058+ set the itemDelimiter to slash
1059+ put item - 2 of pFolder into tExtension
1060+
1061+ put files (specialFolderPath ("engine" ) & "/" & tExtension ) & return & \
1062+ folders (specialFolderPath ("engine" ) & "/" & tExtension ) into tLibraries
1063+ filter tLibraries without ".*"
1064+
1065+ if tLibraries is not empty then
1066+ set the itemDelimiter to "."
1067+ repeat for each line tLibrary in tLibraries
1068+ -- remove extension
1069+ delete the last item of tLibrary
1070+ if tLibrary is not empty then
1071+ set the revLibraryMapping[tLibrary ] to "./" & tExtension & "/" & tLibrary
1072+ end if
1073+ end repeat
1074+ end if
1075+ else
1076+ -- code folders should be platform ID triples however for the
1077+ -- time being as we have no way to access the data required to
1078+ -- determine the options section of the platform ID so we filter only
1079+ -- arch and platform and hope for the best. Ideally we would have
1080+ -- access to a build options string and give a complete match precedence.
1081+ local tCodeFolders
1082+ put folders (pFolder ) into tCodeFolders
1083+ switch the platform
1084+ case "MacOS"
1085+ filter tCodeFolders with "*-mac*"
1086+ break
1087+ case "Win32"
1088+ filter tCodeFolders with "*-win*"
1089+ break
1090+ default
1091+ filter tCodeFolders with "*-" & toLower (the platform ) & "*"
1092+ break
1093+ end switch
1094+
1095+ local tFilteredCodeFolders
1096+ filter tCodeFolders with the processor & "-*" into tFilteredCodeFolders
1097+ split tFilteredCodeFolders by return as set
1098+ if the platform is "MacOS" then
1099+ -- explicit processor should take precedence over universal builds but
1100+ -- in the event multiple libraries are included and some are universal
1101+ -- we must merge
1102+ local tUniveralFilteredCodeFolders
1103+ filter tCodeFolders with "universal-*" into tUniveralFilteredCodeFolders
1104+ split tUniveralFilteredCodeFolders by return as set
1105+ union tFilteredCodeFolders with tUniveralFilteredCodeFolders
1106+ end if
1107+
1108+ repeat for each key tFolder in tFilteredCodeFolders
1109+ put files (pFolder & "/" & tFolder ) & return & \
1110+ folders (pFolder & "/" & tFolder ) into tLibraries
1111+ filter tLibraries without ".*"
1112+
1113+ if tLibraries is not empty then
1114+ set the itemDelimiter to "."
1115+ repeat for each line tLibrary in tLibraries
1116+ -- remove extension
1117+ delete the last item of tLibrary
1118+ if tLibrary is not empty then
1119+ set the revLibraryMapping[tLibrary ] to pFolder & "/" & tFolder & "/" & tLibrary
1120+ end if
1121+ end repeat
1122+ end if
1123+ end repeat
1124+ end if
1125+ end __MapCodeLibraryForIDE
1126+
10501127private command __LoadExtension pCacheIndex, pSourceType, pSourceFile, pFolder, pStatus, @xError
10511128 if xError is empty then
10521129 if pSourceType is "lcb" then
1053- local tResources , tModule
1130+ local tResources , tModule , tCode
10541131 put pFolder & slash & "resources" into tResources
10551132 put pFolder & slash & "module.lcm" into tModule
1133+ put pFolder & slash & "code" into tCode
1134+ # map code before loading extension
1135+ if there is a folder tCode then
1136+ __MapCodeLibraryForIDE tCode
1137+ end if
10561138 # If we have a resources folder then load with resource path
10571139 if there is a folder tResources then
10581140 load extension from file tModule with resource path tResources
0 commit comments