[Vm-dev] SqueakVMPathAnswersResources preference

Eliot Miranda eliot.miranda at gmail.com
Mon Aug 1 19:34:13 UTC 2011


Hi Bert,

On Mon, Aug 1, 2011 at 5:12 AM, Bert Freudenberg <bert at freudenbergs.de>wrote:

>
>
> On 31.07.2011, at 20:55, Eliot Miranda wrote:
>
> Hi Bert,
>
> On Sun, Jul 31, 2011 at 10:52 AM, Bert Freudenberg <bert at freudenbergs.de>wrote:
>
>>
>>
>> On 31.07.2011, at 19:18, Eliot Miranda wrote:
>>
>> > Hi All,
>> >
>> >     I just added code to the Cog branch for the Mac VM so that whether
>> primVmPath/primitiveVMPath answers the directory containing the VM.app or
>> answers the Resources directory within the .app is controlled by the
>> SqueakVMPathAnswersResources preference in the Info.plist file.  primVmPath
>> is used to determine where to derive the sources file from.
>>
>> Among other places.
>>
>> >  By default primVmPath answers the directory containing the VM.app and
>> therefore the sources file is at the same level, e.g.
>> /Applications/Squeak.app & /Applications/SqueakV41.sources.  But some
>> installations (e.g. Newspeak and the EToys all-in-one) may find it more
>> convenient to put the sources in VM.app/Contents/Resources.
>>
>> That's what Etoys does, of course.
>>
>> > This means one file to install, not 2, etc.  I think it useful that this
>> behavior be in the standard VM.  Esteban, if you agree, perhaps you could
>> integrate into the trunk platforms/Mac OS?
>>
>> Not opposed to the change, but it's unnecessary for all-in-ones like
>> Etoys.  The Squeak logic to open the sources file looks in the image
>> directory anyway, which is the Resources folder.
>>
>
> I didn't find this code when I looked yesterday.  Can you spell this out
> for me?
>
>
> FileDirectory class>>openSources:forImage: {system start up}
> tpr 2/17/2004 19:59
>
> openSources: fullSourcesName forImage: imageName
> "We first do a check to see if a compressed version ofthe sources file is
> present.
> Open the .sources file read-only after searching in:
> a) the directory where the VM lives
> b) the directory where the image came from
> c) the DefaultDirectory (which is likely the same as b unless the
> SecurityManager has changed it).
> "
>
> | sources fd sourcesName |
> (fullSourcesName endsWith: 'sources') ifTrue:
> ["Look first for a sources file in compressed format."
> sources _ self openSources: (fullSourcesName allButLast: 7) , 'stc'
> forImage: imageName.
> sources ifNotNil: [^ CompressedSourceStream on: sources]].
>
> sourcesName _ FileDirectory localNameFor: fullSourcesName.
> "look for the sources file or an alias to it in the VM's directory"
> fd _ FileDirectory on: SmalltalkImage current vmPath.
> (fd fileExists: sourcesName)
> ifTrue: [sources _ fd readOnlyFileNamed: sourcesName].
> sources ifNotNil: [^ sources].
> "look for the sources file or an alias to it in the image directory"
> fd _ FileDirectory on: (FileDirectory dirPathFor: imageName).
> (fd fileExists: sourcesName)
> ifTrue: [sources _ fd readOnlyFileNamed: sourcesName].
> sources ifNotNil: [^ sources].
> "look for the sources in the current directory"
> fd _ DefaultDirectory.
> (fd fileExists: sourcesName)
> ifTrue: [sources _ fd readOnlyFileNamed: sourcesName].
> "sources may still be nil here"
> ^sources
>

yes, I saw that.  But the above implies that the only way the sources are
going to be found in the Resources directory is if primVmPath answers the
Resources directory, right?  And at least in the Cog sources that wasn't the
case until I made modifications.  Does the etoys VM have some modifications
to primVmPath or does it patch the method or...?


>
> - Bert -
>
>
>
>


-- 
best,
Eliot
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20110801/27d803c3/attachment-0001.htm


More information about the Vm-dev mailing list