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

Renaming an image actually loses data if the image is open

Open philippeback opened this issue 6 years ago • 6 comments

philippeback avatar May 06 '18 20:05 philippeback

What do you mean by loses data? The image is not copied to the right location or cannot be deleted?

Under which OS?

VincentBlondeau avatar May 24 '18 18:05 VincentBlondeau

Windows 10. Loses means image trashed.

philippeback avatar May 24 '18 18:05 philippeback

I tried. Indeed, you can loose data but I would say I expected to loose data. When you rename from the launcher interface, you rename files. If the image is still open, it refers to an image file that does not exists anymore. So any change to this image will be discarded. I think the good way to fix that is to disable renaming if an image is open.

demarey avatar May 25 '18 07:05 demarey

@demarey how can you detect that the image is open? I think that listing the processes referencing the image could be a good way

VincentBlondeau avatar May 25 '18 16:05 VincentBlondeau

@VincentBlondeau yes, it is the biggest issue. Find a cross-platform way to detect that an image is open. Did not yet have time to think about it

demarey avatar May 28 '18 09:05 demarey

I just launched an image with PL that was already open. Luckily I saw some warning messages about not being able to create changes file, etc. For neophytes (or people who open lots of images), it would be good if PL could at least warn you before you run an image if it's already running.

I'm not sure cross-platform is possible, given the differences. But there is maybe a way that's not too dependent on the OS. You could see make a single method isRunning for an image path that would work its magic on each OS.

In Windows 10, there's a "Command line" Property for Pharo.exe that has the path to the image:

image

Maybe there's a way to fish it out using some OS calls? The info is there, at least in Windows.

fuhrmanator avatar Jan 16 '19 14:01 fuhrmanator