# HG changeset patch # User Carnë Draug # Date 1373999962 -3600 # Node ID 7a69ab84b8c9efc28eb9ab672b31180ee4040a84 # Parent 54b75bed4bc7df86901eef6dc43440f8c4fdccae __magick_write__: confirm file exists before reading to append. * __magick_read__.cc (__magick_write__): when WriteMode is set to append, file needs to be read first. If file does not exist, act normally. Confirm existence to file and skip reading if false. diff -r 54b75bed4bc7 -r 7a69ab84b8c9 libinterp/dldfcn/__magick_read__.cc --- a/libinterp/dldfcn/__magick_read__.cc Tue Jul 16 17:29:45 2013 +0100 +++ b/libinterp/dldfcn/__magick_read__.cc Tue Jul 16 19:39:22 2013 +0100 @@ -472,7 +472,7 @@ { error ("__magick_read__: invalid value for Index/Frame"); } - // Fix indexex from base 1 to base 0, and at the same time, make + // Fix indexes from base 1 to base 0, and at the same time, make // sure none of the indexes is outside the range of image number. const int n = frameidx.nelem (); for (int i = 0; i < n; i++) @@ -873,7 +873,7 @@ // read at all. const std::string writemode = options.getfield ("writemode")(0).string_value (); std::vector ini_imvec; - if (writemode == "append") + if (writemode == "append" && file_stat (filename).exists ()) { read_file (filename, ini_imvec); if (error_state)