#!/bin/sh # MetaCard 2.4 stack # The following is not ASCII text, # so now would be a good time to q out of more exec mc $0 "$@" 4wDevSetup " klocal sSaveDir, sSaveType, sDataStack on InstallFiles pPluginsFlag local tPath -- if pPluginsFlag is empty then answer folder "Select a folder to install into:" if it is empty then exit to top put it into tPath else put the filename of stack "home" into tPath set the itemDel to "/" put "Plugins/" into last item of tPath end if -- DeArchive tPath -- if there is a stack "revMenuBar" then -- -- in Rev: answer "Devolution installed succesfully."&\ cr&cr&"You'll need to restart to see the '4W Devolution' item in the 'Plugins' menu."&cr\ &"Would you like to open it now anyway?" with "Do Not Open" or "Open Now" else answer "Devolution installed successfully."&\ cr& "Open it now?" with "Do not Open" or "Open Now" end if if it is "Open Now" then open stack tPath&"4W Devolution.rev" end InstallFiles on DeArchive pDestPath local i, tKey, tFile, tSubFolder, tTargetDir put the directory into sSaveDir set the directory to pDestPath -- set the endValue of sb "progress" to the uCount of this stack set the itemdel to tab put 0 into i put the fileType into sSaveType show sb "progress" repeat add 1 to i set the thumbpos of sb "progress" to i put the uKey[i] of this stack into tKey if tKey is empty then exit repeat put item 1 of tKey into tFile set the filetype to (last item of tKey) --- -- build folders as needed: set the itemdel to "/" put tFile into tSubFolder delete last item of tSubFolder put empty into tTargetDir if tSubFolder is not empty then -- there are folders specified: if char 1 of tSubFolder = "/" then delete char 1 of tSubFolder repeat for each item tNuFolderName in tSubFolder put tNuFolderName & "/" after tTargetDir if there is not a folder tTargetDir then create folder tTargetDir Err the result, "Can't create folder "&q(tTargetDir) end if end repeat end if set the itemdel to tab -- get the uData[i] of this stack put decompress(it) into url ("binfile:"&tFile) Err the result, tFile -- if (item 2 of tKey = "true") and (the platform is "MacOS") then -- bug in rev 2.1: if ":" is in tFile then next repeat get the uRes[i] of stack sDataStack put decompress(it) into url ("resfile:"&tFile) Err the result, "r"&& tFile end if end repeat -- set the thumbpos of sb "progress" to 0 -- set the fileType to sSaveType set the directory to sSaveDir hide sb "progress" end DeArchive function VersionIsNewer pLocalVers, pRemoteVers return Version2Int(pLocalVers) < Version2Int(pRemoteVers) end VersionIsNewer function Version2Int pVers local i, tInt -- if pVers is empty then return 0 replace "b" with ".0" in pVers replace "a" with ".0.0" in pVers replace "d" with ".0.0.0" in pVers set the itemdel to "." put 0 into item 6 of pVers repeat for each item i in pVers put PadN(i,3) after tInt end repeat return tInt end Version2Int function PadN s,n put n-len(s) into n repeat n put "0" before s end repeat return s end PadN function CurrentPluginsFolder if there is a stack "MetaCard Menu Bar" then return mcPluginsFolder() else get the filename of stack "Home" set the itemdel to "/" put "Plugins" into last item of it if there is a folder it then return it else return empty end if end CurrentPluginsFolder on Err s, m if s is not empty then answer s && m exit to top end if end Err function q s return quote &s& quote end q on PutS s put s into fld "status" end PutS on preOpenCard if the platform is "MacOS" then put 17 into tHeight else put 12 into tHeight repeat with i = 1 to the number of btns set the textHeight of btn i to tHeight end repeat end preOpenCard on StripAndShip put empty into fld "status" of stack "4wDevSetup" put empty into fld "status" of stack "4wDevUpdate" put empty into fld "info" of stack "4wDevUpdate" put empty into fld "list" of stack "4wDevUpdate" compact stack "4wDevSetup" save stack "4wDevSetup" end StripAndShip ` o 9| 4W devolution Setup U Lucida Grande U Lucida Grande U Lucida Grande U Arial Black U Arial Narrow U Arial Narrow U Arial 0 U Arial U Lucida Grande uKey uData Pon preOpenCard hide scrollbar "progress" if there is not a folder (fld "Folder") then put CurrentPluginsFolder()&"/" into fld "Folder" enable btn "update" set the label of btn "update" to "Download and Install..." end if -- extra thing we have to do because Rev does not honor the engine's -- normal opening behavior: set the style of this stack to "modeless" pass preOpenCard end preOpenCard | cREVGeneral scriptChecksum +CqpATUm83 bookmarks handlerList preOpenCardscriptSelection char 299 to 298prevHandler preOpenCardtempScript script
on preOpenCard
hide scrollbar "progress"
if there is not a folder (fld "Folder") then
put CurrentPluginsFolder()&"/" into fld "Folder"
end if
-- extra thing we have to do because Rev does not honor the engine's
-- normal opening behavior:
set the style of this stack to "modeless"
pass preOpenCard
end preOpenCard
desc A ' E progress Aa #k J7 4 Select Installation Folder... E on mouseUp answer folder "Select a folder to install into:" if it is empty then exit to top put it &"/" into fld "folder" enable btn "update" end mouseUp cREVGeneral folder x on mouseUp if the optionKey is "down" then answer "Clear installation folder?" with "Cancel" or "Clear" if it is "Cancel" then exit to top put empty into fld "folder" disable btn "update" save this stack end if end mouseUp 2 cREVGeneral /Playtime/Revolution/Plugins/ update e on mouseUp local tData, tLine, tFileName, tPath, tUpdateList, i -- set cursor to watch put empty into fld "List" of stack "4wDevUpdate" PutS "Contacting server..." -- if there is a stack "MetaCard Menu Bar" then start using "libUrl" put url "http://www.fourthworld.net/revnet/devolution/devo_index.idx" into tData if the result is not empty then answer "Couldn't download updates list:"&cr& the result exit to top end if PutS "Getting file info..." put decompress(tData) into tData -- put fld "folder" into tBasePath if the platform is "MacOS" then put 67790 into tCheckOFF put 67791 into tCheckON else put 67792 into tCheckOFF put 67793 into tCheckON end if -- set the itemdel to tab repeat for each line tLine in tData put item 4 of tLine into tFileName if char -3 to -1 of tFileName = ".gz" then delete char -3 to -1 of tFileName if tFileName <> "4wDevolution.rev" then put "4wTools/" before tFileName put tBasePath & tFileName into tPath if there is not a stack tPath then put "