StandaloneStartup.st
branchjv
changeset 18117 eb433f2c42b2
parent 18112 0d7ac9096619
parent 15899 4dcd8c4200b0
child 18120 e3a375d5f6a8
equal deleted inserted replaced
18116:bf7f37b63ea2 18117:eb433f2c42b2
   832     "Modified: / 24-05-2011 / 17:40:26 / cg"
   832     "Modified: / 24-05-2011 / 17:40:26 / cg"
   833 !
   833 !
   834 
   834 
   835 loadPatch:fileName
   835 loadPatch:fileName
   836     self verboseInfo:('loading patch: ',fileName baseName).
   836     self verboseInfo:('loading patch: ',fileName baseName).
   837     Smalltalk silentFileIn:fileName pathName.
   837     [
       
   838         Smalltalk silentFileIn:fileName pathName.
       
   839     ] on:InvalidPatchError do:[:ex|
       
   840         self verboseInfo:('invalid patch: %1 error: %2'
       
   841                                  bindWith:fileName baseName with:ex messageText).
       
   842         ^ false.
       
   843     ].
       
   844     ^ true
   838 !
   845 !
   839 
   846 
   840 loadPatches
   847 loadPatches
   841     "load all patches in the application's patches dir"
   848     "load all patches in the application's patches dir"
   842 
   849 
   847 loadPatchesMatching:aGlobString
   854 loadPatchesMatching:aGlobString
   848     "load the patches in the application's patches dir.
   855     "load the patches in the application's patches dir.
   849      If aGlobString ist not empty or nil, only patches matching the glob
   856      If aGlobString ist not empty or nil, only patches matching the glob
   850      pattern are loaded. E.g. '[0-9]*.chg'"
   857      pattern are loaded. E.g. '[0-9]*.chg'"
   851 
   858 
   852     |patchesDir prevMode patchesToLoad patchFile|
   859     |patchesDir prevMode patchesToLoad|
   853 
   860 
   854     patchesDir := self patchesDirectory.
   861     patchesDir := self patchesDirectory.
   855     patchesDir isDirectory ifTrue:[
   862     patchesDir isDirectory ifTrue:[
   856         prevMode := ClassCategoryReader sourceMode.
   863         prevMode := ClassCategoryReader sourceMode.
   857         ClassCategoryReader sourceMode:#discard.
   864         ClassCategoryReader sourceMode:#discard.
   858         [
   865         [
   859             patchesToLoad := patchesDir directoryContents.
   866             patchesToLoad := patchesDir directoryContentsAsFilenames.
   860             patchesToLoad := patchesToLoad select:[:eachFilenameString|
   867             patchesToLoad := patchesToLoad select:[:eachFilenameString|
   861                     eachFilenameString asFilename isRegularFile 
   868                     eachFilenameString asFilename isRegularFile 
   862                 ].
   869                 ].
   863             aGlobString notEmptyOrNil ifTrue:[
   870             aGlobString notEmptyOrNil ifTrue:[
   864                 patchesToLoad := patchesToLoad select:[:eachFilenameString|
   871                 patchesToLoad := patchesToLoad select:[:eachFilename|
   865                         aGlobString match:eachFilenameString caseSensitive:false
   872                         aGlobString match:eachFilename baseName caseSensitive:false
   866                     ].
   873                     ].
   867             ].
   874             ].
   868             patchesToLoad sort do:[:eachFilenameString |
   875             (patchesToLoad sort:[:a :b | a baseName < b baseName]) do:[:patchFile |
   869                 patchFile := patchesDir construct:eachFilenameString.
   876                 self loadPatch:patchFile.
   870                 patchFile isDirectory ifTrue:[
       
   871                     ('patch file ', patchFile pathName, ' is a directory') errorPrintCR.
       
   872                 ] ifFalse:[                       
       
   873                     self loadPatch:(patchesDir construct:eachFilenameString).
       
   874                 ].
       
   875             ].
   877             ].
   876         ] ensure:[
   878         ] ensure:[
   877             ClassCategoryReader sourceMode:prevMode.
   879             ClassCategoryReader sourceMode:prevMode.
   878         ].
   880         ].
   879     ].
   881     ].
  1021 
  1023 
  1022 setupToolsForNoDebug
  1024 setupToolsForNoDebug
  1023     Smalltalk isStandAloneApp ifTrue:[
  1025     Smalltalk isStandAloneApp ifTrue:[
  1024         self removeDebugger.
  1026         self removeDebugger.
  1025         self removeInspector.
  1027         self removeInspector.
  1026         self removeLauncher.
       
  1027 
  1028 
  1028         Verbose ifTrue:[ 'debug disabled.' errorPrintCR ].
  1029         Verbose ifTrue:[ 'debug disabled.' errorPrintCR ].
  1029         self redirectStandardStreams.
  1030         self redirectStandardStreams.
  1030     ].
  1031     ].
  1031 
  1032 
  1194 ! !
  1195 ! !
  1195 
  1196 
  1196 !StandaloneStartup class methodsFor:'documentation'!
  1197 !StandaloneStartup class methodsFor:'documentation'!
  1197 
  1198 
  1198 version
  1199 version
  1199     ^ '$Header: /cvs/stx/stx/libbasic/StandaloneStartup.st,v 1.79 2013-11-26 17:49:15 cg Exp $'
  1200     ^ '$Header: /cvs/stx/stx/libbasic/StandaloneStartup.st,v 1.82 2014-01-23 14:01:49 stefan Exp $'
  1200 !
  1201 !
  1201 
  1202 
  1202 version_CVS
  1203 version_CVS
  1203     ^ '$Header: /cvs/stx/stx/libbasic/StandaloneStartup.st,v 1.79 2013-11-26 17:49:15 cg Exp $'
  1204     ^ '$Header: /cvs/stx/stx/libbasic/StandaloneStartup.st,v 1.82 2014-01-23 14:01:49 stefan Exp $'
  1204 ! !
  1205 ! !
  1205 
  1206 
  1206 
  1207 
  1207 StandaloneStartup initialize!
  1208 StandaloneStartup initialize!