@@ -666,11 +666,9 @@ on __extensionSendProgressUpdate pCacheIndex, pMessage, pProgress
666666 // Send message to registered targets
667667end __extensionSendProgressUpdate
668668
669- private function __fetchModuleData pExtensionFile
670- local tDataA , tFolder
671- set the itemdelimiter to slash
672- put item 1 to - 2 of pExtensionFile into tFolder
673- revIDEExtensionFetchMetadata tFolder & slash & "manifest.xml" , tDataA
669+ private function __fetchModuleData pFolder, pExtFile
670+ local tDataA
671+ revIDEExtensionFetchMetadata pFolder & slash & "manifest.xml" , tDataA
674672 # If we couldn't fetch a type id, or there was no manifest then the result will not be empty
675673 if the result is not empty then
676674 put "Invalid manifest" into tDataA ["error" ]
@@ -679,22 +677,19 @@ private function __fetchModuleData pExtensionFile
679677 return tDataA
680678end __fetchModuleData
681679
682- private function __fetchScriptLibraryData pExtensionFile
683- local tDataA , tFolder , tFile
684- set the itemdelimiter to slash
685- put item 1 to - 2 of pExtensionFile into tFolder
686- put item - 1 of pExtensionFile into tFile
680+ private function __fetchScriptLibraryData pFolder, pExtFile
681+ local tDataA
687682 # Generate extension API from source if there is not one present in the folder
688683 # Don't do in an installed IDE as we might not be able to generate the files in the appropriate location
689684 if not revEnvironmentIsInstalled() or \
690- not tFolder begins with revEnvironmentExtensionsPath() then
691- revIDEExtensionUpdateAPI tFolder , tFile
685+ not pFolder begins with revEnvironmentExtensionsPath() then
686+ revIDEExtensionUpdateAPI pFolder , pExtFile
692687 end if
693688
694689 # Get library metadata from the docs, in lieu of a manifest
695690 local tDocA
696691 dispatch function "revDocsParseDocFileToLibraryArray" to stack "revDocsParser" \
697- with (tFolder & slash & "api.lcdoc" )
692+ with (pFolder & slash & "api.lcdoc" )
698693 put the result into tDocA
699694
700695 set the itemdelimiter to comma
@@ -820,13 +815,18 @@ command revIDEExtensionFetchSourceFromFolder pFolder, @rSource, @rType
820815
821816 local tExtFile , tType
822817 filter tFiles with "*.lcb" into tExtFile
823- put "lcb" into tType
824- if tExtFile is empty then
825- put "lcs" into tType
818+ if there is a file (pFolder & slash & "module.lcm" ) \
819+ or tExtFile is not empty then
820+ put "lcb" into tType
821+ end if
822+ if tType is empty then
826823 filter tFiles with regex pattern ".*\.livecode(script)?$" into tExtFile
824+ if tExtFile is not empty then
825+ put "lcs" into tType
826+ end if
827827 end if
828828
829- if tExtFile is empty then
829+ if tType is empty then
830830 put "none" into tType
831831 end if
832832
@@ -846,19 +846,19 @@ private command __FindExtensionsInFolderRecursive pFolder, pIsUserFolder, @xData
846846 end if
847847
848848 -- If we found no extensions, recurse
849- if tNumExtensions is 0 then
849+ if tType is "none" then
850850 repeat for each line tSubFolder in folders (pFolder )
851851 if tSubFolder begins with "." then next repeat
852- __FindExtensionsInFolderRecursive pFolder & slash & tSubFolder , pIsUserFolder , xDataA
852+ __FindExtensionsInFolderRecursive pFolder & slash & tSubFolder , \
853+ pIsUserFolder , xDataA
853854 end repeat
854855 exit __FindExtensionsInFolderRecursive
855856 end if
856857
857- put pFolder & slash & tExtFile into tExtSource
858858 if tType is "lcb" then
859- put __fetchModuleData(tExtSource ) into tArray
859+ put __fetchModuleData(pFolder , tExtFile ) into tArray
860860 else
861- put __fetchScriptLibraryData(tExtSource ) into tArray
861+ put __fetchScriptLibraryData(pFolder , tExtFile ) into tArray
862862 end if
863863
864864 put tExtFile into tArray ["source_file" ]
@@ -972,14 +972,15 @@ private command __extensionLoad pID, pExtensionDataA
972972 # Only try to load the first copy in the load order
973973 put pExtensionDataA ["copies" ][1 ] into tToLoadA
974974
975- local tFolder , tVersion , tStatus , tError , tIDEExtension , tSourceFile
975+ local tFolder , tVersion , tStatus , tError , tIDEExtension , tSourceFile , tSourceType
976976 put tToLoadA ["install_path" ] into tFolder
977977 put tToLoadA ["version" ] into tVersion
978978 put tToLoadA ["status" ] into tStatus
979979 put tToLoadA ["error" ] into tError
980980 put tToLoadA ["ide" ] into tIDEExtension
981981 put tToLoadA ["source_file" ] into tSourceFile
982- revIDEExtensionLoad pID , tFolder , tVersion , tStatus , tError , tIDEExtension , tSourceFile , tToLoadA
982+ put tToLoadA ["source_type" ] into tSourceType
983+ revIDEExtensionLoad tSourceType , pID , tFolder , tVersion , tStatus , tError , tIDEExtension , tSourceFile , tToLoadA
983984end __extensionLoad
984985
985986private command __revIDELCBExtensionLoad pID, pFolder, pVersion, pStatus, pError, pIsIDEExtension, pSourceFile, pAdditionalInfoA
@@ -1095,7 +1096,7 @@ private command __revIDELCSExtensionLoad pID, pFolder, pVersion, pStatus, pError
10951096 end if
10961097
10971098 if pAdditionalInfoA is empty then
1098- put __fetchScriptLibraryData(pFolder & slash & pSourceFile ) into pAdditionalInfoA
1099+ put __fetchScriptLibraryData(pFolder , pSourceFile ) into pAdditionalInfoA
10991100 end if
11001101
11011102 # Update name, status, error, and whether the extension comes with the IDE
@@ -1141,11 +1142,10 @@ private command __revIDELCSExtensionLoad pID, pFolder, pVersion, pStatus, pError
11411142 return tError
11421143end __revIDELCSExtensionLoad
11431144
1144- command revIDEExtensionLoad pID, pFolder, pVersion, pStatus, pError, pIDEExtension, pSourceFile, pAdditionalInfoA
1145- set the itemdel to "."
1146- if item - 1 of pSourceFile is "lcb" then
1145+ command revIDEExtensionLoad pType, pID, pFolder, pVersion, pStatus, pError, pIDEExtension, pSourceFile, pAdditionalInfoA
1146+ if pType is "lcb" then
11471147 __revIDELCBExtensionLoad pID , pFolder , pVersion , pStatus , pError , pIDEExtension , pSourceFile , pAdditionalInfoA
1148- else if item - 1 of pSourceFile begins with "livecode " then
1148+ else if pType is "lcs " then
11491149 __revIDELCSExtensionLoad pID , pFolder , pVersion , pStatus , pError , pIDEExtension , pSourceFile , pAdditionalInfoA
11501150 end if
11511151end revIDEExtensionLoad
@@ -1334,7 +1334,7 @@ command revIDEExtensionMetadata pFolder, pFile, pType, @rDataA
13341334 revIDEExtensionFetchMetadata pFolder & slash & "manifest.xml" , tDataA
13351335 put the result into tResult
13361336 else
1337- put __fetchScriptLibraryData(pFolder & slash & pFile ) into tDataA
1337+ put __fetchScriptLibraryData(pFolder , pFile ) into tDataA
13381338 end if
13391339 put tDataA into rDataA
13401340 return tResult
0 commit comments