Search code examples
smalltalksqueak

Squeak cannot locate the sources file named /Applications/SqueakV60.sources on MacOS


I'm new to Smalltalk. I decided I'd give it a shot and see what it was about.

I decided on Squeak as my flavour of the day, went to the site and installed the Squeak 6.0 universal Mac app and threw it into my applications folder like I do with all other .app files.

When it came to save an image of my environment, it saved inside the Squeak6.0.app folder by default, and in there it works flawlessly.

As soon as I move the .image and .changes files outside that folder and try running the image I'm met with this popup:

Squeak warning

The weird thing is that the image seems to be working fine. I can follow along in code examples without issue, I'm just worried that something may actually break.

Is there a way I can keep my images in my projects folder without having it live inside of the .app?


Solution

  • Squeak looks for the .sources file in specific locations (see the method SmalltalkImage>>#sourcesFilePaths for reference):

    1. Path of the VM
    2. Path of the Image file
    3. On Unix (Linux etc):
      1. /usr/share/squeak/
      2. /usr/local/share/squeak/

    The first (VM-path) is special on OSX, because it also means the location of the .app itself.

    So when your Squeak.app (or silmilar) is in /Applications/, Squeak will look for the .sources there first.

    Solutions

    1. You can put the SqueakV60.source in /Applications. This will work for all images started with your Squeak.app that lives there.
    2. You can put the SqueakV60.source next to your .image file for every image. This has worked for you so far, because the .image and .sources are both in the Resouces folder of the .app.

    I would recommend the first option.

    Background

    Squeak uses .sources files to look up source code for various methods. This is done to have the images a little bit "slimmer", as opposed to storing the method's source code in the image (which is possible but not always done).

    For that, each major release (and some special point releases) has the vast majority of it's method's source code in the respecivve SqueakV??.sources file.

    (Note that the .changes file of the image serves a similar purpose, but for methods that you or others change for your inidivual image).

    As @timRowledge points out, the image can happily live without the sources, but browsing source code is not as fun anymore.