Mac: Drag from OS to replace script deletes it

Here’s a bug I hit yesterday (and verified in the general case today):

  1. Open a suite
  2. Find the scripts folder for your suite in the Finder
  3. Drag one of the scripts from the Finder to the suite window
    –> Alert shows asking if you want to replace the script
  4. OK the alert

The script is gone from your suite and deleted from your hard drive. Crap, that’s some work lost! (And I didn’t have a backup, yipe!)

Recommended solutions (with the last being the most important!):

  • Check whether the script is actually the one already in the suite and put up a message that is pertinent; don’t do any replace
  • When doing a replace, don’t delete the script being replaced – rename it, move it, etc.
  • If you have to delete a file, move it to the trash instead, so that the user can recover in case of an error

I can confirm this issue, but copying a script over itself is from the Finder back to eggPlant isn’t an everyday activity. We’ll make a note of it.

Agreed, not a common activity. But data loss when it happens.

It happened because I changed the filename in the Finder (just dropped the .script extension), but the Suite window hadn’t updated, so I thought things were out of synch.

The suite only shows .script files. If you remove the extension it becomes just a text file and is no longer associated with the eggPlant application.

Not true on Mac. I’m looking at a suite with “Test” and “Wake-Up.script” items in the suite view, matching the file name. “Test” has no extension in the Finder.

I don’t know what you’re actually seeing, but it’s not a behavior that you can rely on – maybe something is cached or it’s just that you still have the script open in the editor. To verify, I just removed the extension from some existing scripts and they immediately disappeared from the Scripts tab. I could no longer run them using the RunWithNewResults command and even though eggPlant would run them when they were referred to in another script, if an error occurs while running one of them, eggPlant reports being unable to find the script to display the line on which the error occurred.

This sounds like it’s devolving into a “Don’t hold the phone like that” thing.

I’ll keep my eyes open for quirks which might happen if I have any scripts without an extension, but back to the real issue…

Please try to fix the bug where replacing a script with itself causes the script to be irretrievably deleted. Completely reproducible, completely fatal.