'From Squeak3.2alpha of 8 October 2001 [latest update: #4515] on 14 November 2001 at 3:14:32 pm'! "Change Set: dndResFix-mir Date: 14 November 2001 Author: Michael Rueger Fixes a bug with resources (images) dnd'ed into Squeak."! !ResourceManager class methodsFor: 'resource caching' stamp: 'mir 11/6/2001 16:16'! lookupCachedResource: cachedUrlString ifPresentDo: streamBlock "See if we have cached the resource described by the given url and if so, evaluate streamBlock with the cached resource." | urlString candidates url stream | CachedResources ifNil:[^self]. candidates _ CachedResources at: cachedUrlString ifAbsent:[nil]. (self lookupCachedResource: cachedUrlString in: candidates ifPresentDo: streamBlock) ifTrue: [^self]. urlString _ self relocatedExternalResource: cachedUrlString. urlString ifNil: [^self]. candidates _ CachedResources at: urlString ifAbsent:[nil]. candidates ifNil: [ (url _ urlString asUrl) schemeName = 'file' ifTrue: [ stream _ url retrieveContents contentStream. [streamBlock value: stream] ensure: [stream close]]] ifNotNil: [self lookupCachedResource: urlString in: candidates ifPresentDo: streamBlock]! ! !ResourceManager class methodsFor: 'resource caching' stamp: 'mir 11/6/2001 15:46'! renameCachedResource: urlString to: newUrlString external: isExternal "A project was renamed. Reflect this change by duplicating the cache entry to the new url." | candidates | CachedResources ifNil:[^self]. candidates _ CachedResources at: urlString ifAbsent:[nil]. (candidates isNil or:[candidates size = 0]) ifFalse: [ candidates do: [:candidate | self addCacheLocation: candidate for: newUrlString]]. isExternal ifTrue: [self relocatedExternalResource: urlString to: newUrlString]! !