Sublime Forum

Problems with 7-zip integration as editor

#1

One of things I used to do often with my old text editor was edit text files within zip archives while having them open in the 7-zip program. 7-zip allows editing files within archives by creating a temporary folder in C:\Documents and Settings%USER%\Local Settings\Temp, copying the file there and then checking on it to see whether or not it gets modified. If so, the next time 7-zip is focused, it asks you if you’d like to refresh that particular file in the archive you have open.

For some reason, this doesn’t work in Sublime Text. When I set my editor to be ST, the folder gets created in the Temp directory, and ST opens the correct file for editing (the path and filename are in the title bar), however when you look in the created folder it is empty. It’s as if 7-zip did everything correctly, then immediately deleted the temp file as soon as Sublime Text opened it. If you then save the file using ST, the file is created, but by this time 7-zip has stopped watching because it never asks you if you would like to refresh the file in the archive. This effectively breaks the edit-within-archive ability.

I tested this 7-zip file edit system using Metapad, Wordpad, and OpenOffice SWriter, and the only program for which the behaviour was broken was Sublime Text. Even knowing that, though, I’m not exactly sure what is going on here. Is there some sort of action ST performs on a file while opening that would make 7-zip just delete it?

0 Likes

#2

This is likely because Sublime Text is already running, so the instance that is spawned by 7-zip will simply hand the command line arguments over to the existing process and exit (see also Powershell: how to block shell until ST is closed?). I assume 7-zip is simply deleting the temporary file as soon as the process it spawned exits.

WinSCP has a setting to integrate with editors that work this way (it’s fairly common) - the “External editor opens multiple files in one window” option.

0 Likes