home *** CD-ROM | disk | FTP | other *** search
- -- 2000.02.26
- -- Clive Green <clivegreen@atlas.co.uk>
-
- ------------------------------------------------------------------------------------------------------
-
- -- rudimentary installation services:
-
- ------------------------------------------------------------------------------------------------------
-
- -- declare properties:
- property main -- main code directory object
- property defaultLaunchState -- the default mode to launch any application in
- property installerPaths -- a list of installer filepaths on the CD-ROM
-
- ------------------------------------------------------------------------------------------------------
-
- on new me,L
-
- -- (1) extract and check arguments:
-
- -- check for a parameter list:
- if ilk(L) <> #propList then return ¬
- [#error:#noParamListSupplied, #msg:"installerService:new"]
-
- -- a reference to the parent codebase is REQUIRED:
- main = L[#main]
-
- if (ilk(main) <> #instance) then return ¬
- [#error:#noMainObjectSupplied, #msg:"installerService:new"]
-
- --------------------
-
- -- store literals:
- defaultLaunchState = "Normal"
-
- --------------------
-
- -- (2) obtain installer data for the current platform:
- um = main.getUtilityMethods()
- p = um.thePlatform()
- n = symbol(p & "installerPaths") -- (ie: #pcInstallerPaths)
-
- dm = main.getDataManager()
- installerPaths = dm.getData([#set:n])
-
- -- NOTE:
- -- don't assume installer paths strings will automatically be platform compliant;
- -- always use the "utilityMethods:parseFilePath" function to make sure.
-
- --------------------
-
- -- pass back my address:
- return me
-
- ----------------------------------------------------------------------------------------------------
-
- on installApp me,L
-
- -- extract id of installer application to be launched:
- id = L[#appID]
- if not symbolP(id) then return ¬
- [#error:#noInstallerIDsupplied, #msg:"installerService:installApp"]
-
- --------------------
-
- -- get a valid data entry:
- pL = installerPaths[id]
- if ilk(pL) <> #propList then return ¬
- [#error:#unrecognisedInstallerID, #msg:"installerService:installApp" && id]
-
- --------------------
-
- -- IMPORTANT:
- -- use a duplicate to prevent modification of the original listing!
- pL = duplicate(pL)
-
- --------------------
-
- -- check entries exist for filepath and desired launch state:
- if not stringP(pL[#filePath]) then return ¬
- [#error:#noFilePath, #msg:"installerService:installApp" && id]
-
- -- set default launch state if none is specified:
- if not stringP(pL[#state]) then pL[#state] = defaultLaunchState
-
- --------------------
-
- -- the install software lives on the CD-ROM -
- -- so we'll ask the CDROM service to run the installer file:
- sm = main.getServiceManager()
- cd = sm.getService(#CDROMservice)
-
- r = cd.launchCDfile(pL)
-
- -- pass error package to caller as needed:
- if r <> 1 then return r
-
- --------------------
-
- -- assume successful operation - now request programme termination:
- ns = sm.getService(#navigationService)
- ns.doQuit()
-
- ----------------------------------------------------------------------------------------------------