Fix save_complete

svn path=/trunk/netsurf/; revision=13073
This commit is contained in:
Chris Young 2011-10-22 14:03:47 +00:00
parent a4f14eb0e9
commit a7f2cfa521
1 changed files with 44 additions and 42 deletions

View File

@ -112,52 +112,54 @@ void ami_file_save(int type, char *fname, struct Window *win,
if(ami_download_check_overwrite(fname, win, 0))
{
if(fh = FOpen(fname, MODE_NEWFILE,0))
if(type == AMINS_SAVE_COMPLETE)
{
switch(type)
if(lock = CreateDir(fname))
{
case AMINS_SAVE_SOURCE:
if((source_data = content_get_source_data(object, &source_size)))
FWrite(fh, source_data, 1, source_size);
break;
case AMINS_SAVE_COMPLETE:
if(lock = CreateDir(fname))
{
UnLock(lock);
save_complete(object, fname);
amiga_icon_superimpose_favicon(fname, favicon, NULL);
}
break;
case AMINS_SAVE_TEXT:
save_as_text(object, fname);
break;
case AMINS_SAVE_PDF:
#ifdef WITH_PDF_EXPORT
if(save_as_pdf(object, fname))
amiga_icon_superimpose_favicon(fname, favicon, "pdf");
#endif
break;
case AMINS_SAVE_IFF:
if((bm = content_get_bitmap(object)))
{
bm->url = (char *)nsurl_access(content_get_url(object));
bm->title = (char *)content_get_title(object);
bitmap_save(bm, fname, 0);
}
#ifdef WITH_NS_SVG
else if(ami_mime_compare(object, "svg") == true)
{
ami_save_svg(object, fname);
}
#endif
break;
UnLock(lock);
save_complete(object, fname);
amiga_icon_superimpose_favicon(fname, favicon, NULL);
}
}
else
{
if(fh = FOpen(fname, MODE_NEWFILE,0))
{
switch(type)
{
case AMINS_SAVE_SOURCE:
if((source_data = content_get_source_data(object, &source_size)))
FWrite(fh, source_data, 1, source_size);
break;
FClose(fh);
case AMINS_SAVE_TEXT:
save_as_text(object, fname);
break;
case AMINS_SAVE_PDF:
#ifdef WITH_PDF_EXPORT
if(save_as_pdf(object, fname))
amiga_icon_superimpose_favicon(fname, favicon, "pdf");
#endif
break;
case AMINS_SAVE_IFF:
if((bm = content_get_bitmap(object)))
{
bm->url = (char *)nsurl_access(content_get_url(object));
bm->title = (char *)content_get_title(object);
bitmap_save(bm, fname, 0);
}
#ifdef WITH_NS_SVG
else if(ami_mime_compare(object, "svg") == true)
{
ami_save_svg(object, fname);
}
#endif
break;
}
FClose(fh);
}
SetComment(fname, nsurl_access(content_get_url(object)));
}
}