home *** CD-ROM | disk | FTP | other *** search
/ LineOne ISP Sign-Up 5 / LineOne.iso / assets / cxt / scripts / parentScripts.cst / 00079_installerService parent.ls < prev    next >
Encoding:
Text File  |  2001-01-27  |  3.1 KB  |  104 lines

  1. -- 2000.02.26
  2. -- Clive Green <clivegreen@atlas.co.uk>
  3.  
  4. ------------------------------------------------------------------------------------------------------
  5.  
  6. -- rudimentary installation services:
  7.  
  8. ------------------------------------------------------------------------------------------------------
  9.  
  10. -- declare properties:
  11. property main               -- main code directory object
  12. property defaultLaunchState -- the default mode to launch any application in
  13. property installerPaths     -- a list of installer filepaths on the CD-ROM
  14.  
  15. ------------------------------------------------------------------------------------------------------
  16.  
  17. on new me,L
  18.   
  19.   -- (1) extract and check arguments:
  20.   
  21.   -- check for a parameter list:
  22.   if ilk(L) <> #propList then return ┬¼
  23.   [#error:#noParamListSupplied, #msg:"installerService:new"]
  24.   
  25.   -- a reference to the parent codebase is REQUIRED:
  26.   main = L[#main]
  27.   
  28.   if (ilk(main) <> #instance) then return ┬¼
  29.   [#error:#noMainObjectSupplied, #msg:"installerService:new"]
  30.   
  31.   --------------------
  32.   
  33.   -- store literals:
  34.   defaultLaunchState = "Normal"
  35.   
  36.   --------------------
  37.   
  38.   -- (2) obtain installer data for the current platform:
  39.   um = main.getUtilityMethods()
  40.   p  = um.thePlatform()
  41.   n = symbol(p & "installerPaths") -- (ie: #pcInstallerPaths)
  42.   
  43.   dm = main.getDataManager()
  44.   installerPaths = dm.getData([#set:n])
  45.   
  46.   -- NOTE:
  47.   -- don't assume installer paths strings will automatically be platform compliant;
  48.   -- always use the "utilityMethods:parseFilePath" function to make sure.
  49.   
  50.   --------------------
  51.   
  52.   -- pass back my address:
  53.   return me
  54.   
  55.   ----------------------------------------------------------------------------------------------------
  56.   
  57. on installApp me,L
  58.   
  59.   -- extract id of installer application to be launched:
  60.   id = L[#appID]
  61.   if not symbolP(id) then return ┬¼
  62.   [#error:#noInstallerIDsupplied, #msg:"installerService:installApp"]
  63.   
  64.   --------------------
  65.   
  66.   -- get a valid data entry:
  67.   pL = installerPaths[id]
  68.   if ilk(pL) <> #propList then return ┬¼
  69.   [#error:#unrecognisedInstallerID, #msg:"installerService:installApp" && id]
  70.   
  71.   --------------------
  72.   
  73.   -- IMPORTANT:
  74.   -- use a duplicate to prevent modification of the original listing!
  75.   pL = duplicate(pL)
  76.   
  77.   --------------------
  78.   
  79.   -- check entries exist for filepath and desired launch state:
  80.   if not stringP(pL[#filePath]) then return ┬¼
  81.   [#error:#noFilePath, #msg:"installerService:installApp" && id]
  82.   
  83.   -- set default launch state if none is specified:
  84.   if not stringP(pL[#state]) then pL[#state] = defaultLaunchState
  85.   
  86.   --------------------
  87.   
  88.   -- the install software lives on the CD-ROM -
  89.   -- so we'll ask the CDROM service to run the installer file:
  90.   sm = main.getServiceManager()
  91.   cd = sm.getService(#CDROMservice)
  92.   
  93.   r = cd.launchCDfile(pL)
  94.   
  95.   -- pass error package to caller as needed:
  96.   if r <> 1 then return r
  97.   
  98.   --------------------
  99.   
  100.   -- assume successful operation - now request programme termination:
  101.   ns = sm.getService(#navigationService)
  102.   ns.doQuit()
  103.   
  104.   ----------------------------------------------------------------------------------------------------