pharo-project / pharo-launcher

Lets you manage your pharo images and download new ones
https://pharo-project.github.io/pharo-launcher/
MIT License
108 stars 46 forks source link

`#application was sent to nil` when changing images directory in settings #680

Open daniels220 opened 2 months ago

daniels220 commented 2 months ago

Describe the bug When changing the "Location of your images" setting, if there are images in both the old and new directories, Pharo Launcher attempts to warn that you'll need to manually migrate/merge them. But this now fails due to a change in Spec a while back, introducing the concept of a command "context" that must be set in order to retrieve things like the active "application". Since many commands only access the application in an exceptional path, to notify the user of something for instance, it's easy for this to get missed. And it's not always easy or clear to figure out what the correct context should be.

To Reproduce

  1. Have at least one image in the currently-configured image directory.
  2. Copy at least one image to another directory (call it the "new directory").
  3. Open Settings in Pharo Launcher and attempt to change the "Location of your images" setting to the new directory.
  4. See #application was sent to nil error.

Expected behavior A notification that images must be manually copied, then the setting to be successfully changed.

Version information: Any OS, Pharo Launcher 3.0.1

Expected development cost I fixed something like this in Iceberg a while back...it took a lot of hemming and hawing until I figured out that some other commands already established a clear pattern to follow, then was easy. I don't see an obvious place to get the context from in this case, but once that's established it's not that much code to change.