No exception with missing dir [SOLVED]
Posted: 2012-08-24T11:35:32-07:00
Hi,
I am using the following code as a test case.
This code produces the following output on Linux:
Thanks for the help.
I am using the following code as a test case.
Code: Select all
#include <Magick++.h>
#include <iostream>
using namespace std;
using namespace Magick;
int main()
{
Image test;
string url = "http://skreened.com/c/keuhxtodipbpomnwupfz";
try{
test.read(url);
} catch(Exception e)
{
cout <<e.what()<<endl;
}
if(test.columns()>1)
{
try{
cout <<"writing file"<<endl;
test.write("data/content/k/e/u/keuhxtodipbpomnwupfz.mpc");
} catch(Exception e)
{
cout <<"Doesn't get here ?"<<e.what()<<endl;
}
}
cout <<"done with program"<<endl;
return 0;
}
This occurs when the directories do not exist. My wonder is why this does not throw an exception as it has for all of my other files. My implementation will create the directory structure if an Exception is thrown and then try again. For some reason this file causes a hard abort while other ones throw exceptions like this url "http://skreened.com/c/nztmsatqnreougcsqusq". This url produces the following outputMagick: Ignoring attempt to set cHRM RGB triangle with zero area `/tmp/magick-UwS1UjvY' @ warning/png.c/MagickPNGWarningHandler/1777
writing file
testApp: magick/hashmap.c:466: GetLastValueInLinkedList: Assertion `list_info != (LinkedListInfo *) ((void *)0)' failed.
Aborted
This is what I would expect to happen and is what I handle in my main implementation. The only reason I can think is that failed assertion is causing some problem. Though for all I know the image could be causing the problem as well but I am unsure how to check that is it works if you direct your browser to that link or open it in another program. It also works fine if the directory structure exists which has thrown me for a loop as well unless you have multiple ways of saving a file and its using one that does not throw an exception for some reason.writing file
Doesn't get here ?Magick: unable to open image `data/content/k/e/u/keuhxtodipbpomnwupfz.mpc': No such file or directory @ error/blob.c/OpenBlob/2642
done with program
Thanks for the help.