#REFACTORING by stefan
class: ResourcePack class
changed:
#fromFile:directory:cached:
#processResourceLine:encoding:file:printErrorWith:for:keepUselessTranslations:
--- a/ResourcePack.st Tue Sep 17 21:28:42 2019 +0200
+++ b/ResourcePack.st Sat Sep 28 15:51:20 2019 +0200
@@ -229,6 +229,8 @@
Packs isNil ifTrue:[
Packs := WeakArray new:50.
FailedToLoadPacks := Set new.
+ KeepStatisticsOnUsedKeys := false.
+ DebugModifications := Smalltalk isSmalltalkDevelopmentSystem.
].
"
@@ -241,6 +243,7 @@
"
"Modified: / 28-09-2011 / 15:53:21 / cg"
+ "Modified: / 15-03-2019 / 11:05:34 / Stefan Vogel"
! !
!ResourcePack class methodsFor:'instance creation'!
@@ -278,7 +281,7 @@
for:aClass cached:cached
"get the full resource definitions for aClass (i.e. with super packs).
- Also leave the resulting pack in the cache for faster access next time."
+ Also optionally leave the resulting pack in the cache for faster access next time."
^ self forPackage:(aClass package) cached:cached.
@@ -333,6 +336,7 @@
"Modified: / 01-11-2010 / 09:09:43 / cg"
"Modified: / 16-10-2018 / 17:12:25 / Stefan Vogel"
+ "Modified (comment): / 15-03-2019 / 10:50:07 / Stefan Vogel"
!
forPackage:package
@@ -508,10 +512,10 @@
cachedPack notNil ifTrue:[
"/ Transcript showCR:'cached pack: ',fn asString.
^ cachedPack
- ].
+ ].
newPack := self new.
- KeepStatisticsOnUsedKeys == true ifTrue:[
+ KeepStatisticsOnUsedKeys ifTrue:[
newPack rememberUsedKeys.
].
"/ '5) file ' print. aFileName print.
@@ -523,6 +527,7 @@
^ newPack
"Modified: / 25-09-2018 / 09:57:42 / Claus Gittinger"
+ "Modified: / 28-09-2019 / 15:50:21 / Stefan Vogel"
!
newDefaultResourcePackForPackage:package
@@ -747,9 +752,8 @@
lineStream := lineString readStream.
].
lineStream signalAtEnd:false.
- lineStream skipSeparators.
- lineStream peek == $# ifTrue:[
+ lineStream skipSeparators == $# ifTrue:[
name := Array
readFrom:lineStream
onError:[
@@ -900,8 +904,7 @@
value := aResourcePack string:value.
].
- "/ DebugModifications := true
- DebugModifications == true ifTrue:[
+ DebugModifications ifTrue:[
"/ for debugging only !! (not all primitive code is ready for immutableStrings)
value class == String ifTrue:[
value := value asImmutableString.
@@ -915,6 +918,7 @@
"Modified: / 06-02-2014 / 15:33:03 / cg"
"Modified: / 27-03-2019 / 11:59:49 / Claus Gittinger"
+ "Modified: / 28-09-2019 / 15:20:38 / Stefan Vogel"
!
resourceFileEntryFor:keyString to:nationalString