Smalltalk.st
changeset 25176 fb161da81648
parent 25116 aa3a98621b0a
child 25192 7e8d07778259
equal deleted inserted replaced
25175:9aa9e229640b 25176:fb161da81648
  5946 
  5946 
  5947     f := self getSystemFileName:anAbbrevFilePath.
  5947     f := self getSystemFileName:anAbbrevFilePath.
  5948     f isNil ifTrue:[f := self getPackageFileName:anAbbrevFilePath].
  5948     f isNil ifTrue:[f := self getPackageFileName:anAbbrevFilePath].
  5949 
  5949 
  5950     f notNil ifTrue:[
  5950     f notNil ifTrue:[
  5951 	f := f asFilename.
  5951         f := f asFilename.
  5952 	f isDirectory ifTrue:[
  5952         f isDirectory ifTrue:[
  5953 	    f := f construct:'abbrev.stc'
  5953             f := f construct:'abbrev.stc'
  5954 	].
  5954         ].
  5955 	[
  5955         [
  5956 	    s := f readStream.
  5956             s := f readStream.
  5957 	    self installAutoloadedClassesFromStream:s.
  5957             self installAutoloadedClassesFromStream:s.
  5958 	    s close.
  5958             s close.
  5959 	] on:FileStream openErrorSignal
  5959         ] on:OpenError
  5960 	do:[:ex| "do nothing"].
  5960         do:[:ex| "do nothing"].
  5961     ]
  5961     ]
  5962 
  5962 
  5963     "
  5963     "
  5964      Smalltalk installAutoloadedClassesFrom:'include/abbrev.stc'
  5964      Smalltalk installAutoloadedClassesFrom:'include/abbrev.stc'
  5965      Smalltalk installAutoloadedClassesFrom:'../../goodies/communication/abbrev.stc'
  5965      Smalltalk installAutoloadedClassesFrom:'../../goodies/communication/abbrev.stc'
  6257     haveAbbrevDotSTC := false.
  6257     haveAbbrevDotSTC := false.
  6258     noAutoloadHere ifFalse:[
  6258     noAutoloadHere ifFalse:[
  6259         [
  6259         [
  6260             self installAutoloadedClassesFromAbbrevFile:(dir / 'abbrev.stc').
  6260             self installAutoloadedClassesFromAbbrevFile:(dir / 'abbrev.stc').
  6261             haveAbbrevDotSTC := true.
  6261             haveAbbrevDotSTC := true.
  6262         ] on:FileStream openErrorSignal
  6262         ] on:OpenError do:[:ex|
  6263         do:[:ex|
       
  6264             "ignore this file"
  6263             "ignore this file"
  6265         ].
  6264         ].
  6266     ].
  6265     ].
  6267 
  6266 
  6268     [
  6267     [
  6269         directoryContents := dir directoryContents.
  6268         directoryContents := dir directoryContents.
  6270     ] on:FileStream openErrorSignal do:[:ex|
  6269     ] on:OpenError do:[:ex|
  6271         "non-accessible directory: we are done"
  6270         "non-accessible directory: we are done"
  6272         ^ self
  6271         ^ self
  6273     ].
  6272     ].
  6274 
  6273 
  6275     directoryContents := directoryContents select:[:fn | (fn startsWith:'.') not] as:Set.
  6274     directoryContents := directoryContents select:[:fn | (fn startsWith:'.') not] as:Set.
  6310             (noAutoloadHere not and:[haveAbbrevDotSTC not]) ifTrue:[
  6309             (noAutoloadHere not and:[haveAbbrevDotSTC not]) ifTrue:[
  6311                 f suffix = 'st' ifTrue:[
  6310                 f suffix = 'st' ifTrue:[
  6312                     [
  6311                     [
  6313                         self installAutoloadedClassFromSourceFile:f.
  6312                         self installAutoloadedClassFromSourceFile:f.
  6314                         f directory baseName = 'libbasic' ifTrue:[self halt].
  6313                         f directory baseName = 'libbasic' ifTrue:[self halt].
  6315                     ] on:FileStream openErrorSignal do:[:ex|
  6314                     ] on:OpenError do:[:ex|
  6316                         "ignore this file, but write a warning"
  6315                         "ignore this file, but write a warning"
  6317                         Transcript showCR:('Autoload: cannot install %1. (%2)' bindWith:f pathName with:ex description).
  6316                         Transcript showCR:('Autoload: cannot install %1. (%2)' bindWith:f pathName with:ex description).
  6318                     ].
  6317                     ].
  6319                 ]
  6318                 ]
  6320             ].
  6319             ].
  8284 
  8283 
  8285     |abbrevStream dir directoryContents|
  8284     |abbrevStream dir directoryContents|
  8286 
  8285 
  8287     maxLevels == 0 ifTrue:[
  8286     maxLevels == 0 ifTrue:[
  8288 "/        'Smalltalk [warning]: max directory nesting reached.' infoPrintCR.
  8287 "/        'Smalltalk [warning]: max directory nesting reached.' infoPrintCR.
  8289 	^ self
  8288         ^ self
  8290     ].
  8289     ].
  8291 
  8290 
  8292     dir := aDirectory asFilename.
  8291     dir := aDirectory asFilename.
  8293     dir exists ifFalse:[^ self].
  8292     dir exists ifFalse:[^ self].
  8294 
  8293 
  8295     [
  8294     [
  8296 	abbrevStream := (dir / 'abbrev.stc') asFilename readStream.
  8295         abbrevStream := (dir / 'abbrev.stc') asFilename readStream.
  8297 	self readAbbreviationsFromStream:abbrevStream.
  8296         self readAbbreviationsFromStream:abbrevStream.
  8298 	abbrevStream close.
  8297         abbrevStream close.
  8299     ] on:FileStream openErrorSignal do:[:ex| "ignore this file"].
  8298     ] on:OpenError do:[:ex| "ignore this file"].
  8300 
  8299 
  8301     [
  8300     [
  8302 	directoryContents := dir directoryContents.
  8301         directoryContents := dir directoryContents.
  8303     ] on:FileStream openErrorSignal do:[:ex|
  8302     ] on:OpenError do:[:ex|
  8304 	"non-accessible directory: we are done"
  8303         "non-accessible directory: we are done"
  8305 	^ self
  8304         ^ self
  8306     ].
  8305     ].
  8307 
  8306 
  8308     directoryContents do:[:aFilename |
  8307     directoryContents do:[:aFilename |
  8309 	|f|
  8308         |f|
  8310 
  8309 
  8311 	(#(
  8310         (#(
  8312 	    'doc'
  8311             'doc'
  8313 	    'CVS'
  8312             'CVS'
  8314 	    'bitmaps'
  8313             'bitmaps'
  8315 	    'resources'
  8314             'resources'
  8316 	    'source'
  8315             'source'
  8317 	) includes:aFilename) ifFalse:[
  8316         ) includes:aFilename) ifFalse:[
  8318 	    f := dir / aFilename.
  8317             f := dir / aFilename.
  8319 	    f isDirectory ifTrue:[
  8318             f isDirectory ifTrue:[
  8320 		self recursiveReadAllAbbreviationsFrom:f maxLevels:maxLevels-1
  8319                 self recursiveReadAllAbbreviationsFrom:f maxLevels:maxLevels-1
  8321 	    ]
  8320             ]
  8322 	].
  8321         ].
  8323     ].
  8322     ].
  8324 !
  8323 !
  8325 
  8324 
  8326 reinitializePackagePath
  8325 reinitializePackagePath
  8327     "{ Pragma: +optSpace }"
  8326     "{ Pragma: +optSpace }"