On Mon, 1 Oct 2012, Max Leske wrote:
Hi guys
Is there a way to find out (from outside of the image), if an image has been saved with Cog? What I would like to do is something like this:
$ head -20 myImage.image | grep <some expression>
The use case for this is seaside hosting, where we only have squeak VMs to run images, so when an image is uploaded that was saved with Cog that image cause trouble. Any ideas?
Currently there are 3 image formats around 6502 (old interpreter format, no closures), 6504 (new interpreter format with closures), 6505 (Cog format). The first two bytes of the image file contain the image format in little-endian (IIRC) format. So you can decide it by checking the first byte (head -c 1). If you only support the old interpreter format, then the following bash expression should work: [ $(head -c 1 $IMAGE_NAME) == 'f' ] Levente
Cheers, Max