pharo-launcher icon indicating copy to clipboard operation
pharo-launcher copied to clipboard

"Save As" does not create an image that is launchable

Open apblack opened this issue 6 years ago • 11 comments

If I do a "Save As..." from an existing image (that has been launched form the launcher), new image and changes files are created in the existing launcher folder. But this image cannot be launched from the launcher.

This is because the name of the image does not correspond to the name of the folder.

apblack avatar Nov 24 '17 15:11 apblack

This is already reported in #18

jecisc avatar Nov 24 '17 22:11 jecisc

There are now 2 ways to run an image created with "Save As" :

  • if no image is selected in PharoLauncher and you click on launch, then you get a file browser allowing you to open any image on your filesystem
  • you can import an image into pharo Launcher. It will move the imported image to the default image store of Pharo Launcher.

Is it enough to solve this issue?

demarey avatar Jan 15 '18 13:01 demarey

@apblack Can we close the issue?

VincentBlondeau avatar Jun 11 '18 17:06 VincentBlondeau

I think that you have done everything reasonable as maintainers of the launcher. But I don't think that the issue s solved for the programmer who is using the launcher.

What would solve it would be a variation on "Save As .." in the main menu that will offer to create a "launcher compatible" folder containing the newly-saved image. This would mean that the standard image would have to be able to detect that it was run from the launcher — perhaps by looking to see if the image file is inside a directory of the same name.

So, perhaps the right thing to do is to close this issue, and open one in FogBugz, since this will have to be solved in Pharo itself.

apblack avatar Jun 11 '18 22:06 apblack

I agree with @apblack : the issue is not yet solved but it will be difficult to implement it. The hard point is indeed: how an image could be aware that it has been launched from the launcher? And yes, that means that we should introduce code in the image => new problem: this code can only be introduced into the development version of Pharo and not past releases. It means this functionality could only work starting Pharo 7. As for now, I cannot see a reasonable solution to get this functionality working nicely. It requires more thoughts about it.

demarey avatar Jun 12 '18 06:06 demarey

It is the same kind of problem as my image saver.

A solution would be to have a command listing all images in the folder and offer to open one.

philippeback avatar Jun 12 '18 12:06 philippeback

To amplify what @philippeback said: a solution that could be implemented in the launcher itself would be for the launcher to notice when there is more than one pair of .image & .changes files in the directory that it is about to launch, and to ask the user of the launcher to pick one pair from a list.

I think that the right solution is to introduce new functionality into Pharo 7's "Save As …" command, so that, going forward, this ceases to be a problem. And this is an ideal time to do so, because Pharo 7 is under active development. But, as @demarey points out, this cannot solve the problem for older versions of Pharo. Having the launcher offer a list would solve the problem for such systems.

apblack avatar Jun 12 '18 15:06 apblack

Is it not possible to launch sub images with an additional command line argument ? Such a command line argument can easily be retrieved at the level of the sub image. Maybe even an environment variable might work.

svenvc avatar Jun 12 '18 16:06 svenvc

@svenvc yes, I think it would be a good idea to use an extra command-line argument. That said, it will still require new code to manage that in the standard Pharo image. But that will solve the problem for Pharo images >= 7.0

demarey avatar Jun 19 '18 09:06 demarey

I'm a relatively new person to Pharo (less than 3 years, and much of it was in Pharo 5 with a minimal understanding, so I'm really still quite a newbie). Currently (because of this issue), I don't use Pharo Launcher except when I'm starting with a new image.

In my workflow (on Windows 10), I just run Pharo.exe (from the VM) and select the latest image (done with Save as...) for my project. Windows 10's file system does a great job finding it. Why am I doing "Save as..." with images and not just "Save"? Here are a few reasons:

  1. I don't want to lose my playgrounds (which can't easily be versioned with Git),
  2. I don't want to get stuck with a corrupt image (it happened enough times in Pharo 5 that I am still not trusting things in Pharo 6.1 ;-)).
  3. I want an image to roll back to when I attempt to install some new complex library, e.g., I was trying to get Moose to work with Iceberg, then with OSSubprocess (which doesn't finally work on Windows, etc.).

fuhrmanator avatar Dec 18 '18 12:12 fuhrmanator

As for solutions, I'm a Windows 10 person lately (please forgive me for that), so I know there's a way to have a right-click option in Windows Explorer to say "Open with..." on a file of type .image. Couldn't Pharo Launcher just add its value (i.e., find the right VM for the image) at this level? No need to pass through a GUI.

fuhrmanator avatar Dec 18 '18 12:12 fuhrmanator