[Tilesathome] tilesathome rmtree issue on Windows

Ed Loach ed at loach.me.uk
Thu Sep 4 13:37:59 BST 2008


I don't understand it. I've now got this code in splitImageX

    # Load the tileset image
    statusMessage(sprintf("Splitting %s (%d x 1)", $BigPNGFileName,
$Size),0,3);
    #my $Image = newFromPng GD::Image($File);
    open(PNG, $File) || die;
    my $Image = newFromPng GD::Image(\*PNG) || die;
    close(PNG) or warn $! ? "Error closing : $!"
                   : "Exit status $? ";

    my $current_time = time();
    my $local_time = gmtime($current_time);
    statusMessage("Pause at $local_time after splitImageX close
line\n",1,0);
    sleep(5);

The image is read and not closed by the time the Status Message is
displayed. That is why I tried modifying the close line based on an
example I found on the net, though I'm not sure that I've got it
right. I don't see any warnings anyway, though am not entirely sure
where to look. They aren't in the command window or the status box
in the Windows GUI bit.

The flow seems to be inkscape creates the split_*.png file, perl
then reads (and closes it) when it checks that it exists on the
return from inkscape. splitImageX then opens it, reads it and leaves
it open despite the change above to try and force a close. It then
seems to repeat this for each layer with the lock on the file
allowing inkscape to overwrite the previous image, and then
splitImageX opening it again and leaving it unclosed again. 

I've made another change to try and confirm this; I'm changing the
delay to 30 seconds and during that delay I will try and delete the
file. I've also changed the bit above to:
    my $Image = newFromPng GD::Image($File);
    open(PNG, $File) || die;
    close(PNG);

I'll test it when (if) the upload queue ever lets me upload the
current result ready to restart the program to try the changed
version.

Ed






More information about the Tilesathome mailing list