From 82e704cd1b2e970945a74040d19237fa3fa890d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Sat, 1 Apr 2006 15:51:48 +0000 Subject: [PATCH] Now writes the file type of the PNG files as well. This fixes bug #374, even though it only cures the symptoms, ie. bug #194 remains valid (broken file types when built from Linux). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16954 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/servers/app/PNGDump.cpp | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/src/servers/app/PNGDump.cpp b/src/servers/app/PNGDump.cpp index 800fe6acf4..7745cfdb4a 100644 --- a/src/servers/app/PNGDump.cpp +++ b/src/servers/app/PNGDump.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2001-2005, Haiku. + * Copyright 2001-2006, Haiku. * Distributed under the terms of the MIT License. * * Authors: @@ -11,17 +11,16 @@ #include "PNGDump.h" +#include +#include + +#include + #include #include #include #include -#include - -#include -#include - -#include "frame_buffer_support.h" #define TRACE_PNGDUMP #ifdef TRACE_PNGDUMP @@ -30,6 +29,7 @@ # define TRACE(x) ; #endif + status_t SaveToPNG(const char* filename, const BRect& bounds, color_space space, const void* bits, int32 bitsLength, int32 bytesPerRow) @@ -113,5 +113,13 @@ SaveToPNG(const char* filename, const BRect& bounds, color_space space, png_destroy_write_struct(&png, NULL); fclose(file); + + // Set the file type manually, so that it doesn't have to be + // picked up by the registrar or Tracker, first + BNode node(filename); + BNodeInfo nodeInfo(&node); + if (nodeInfo.InitCheck() == B_OK) + nodeInfo.SetType("image/png"); + return B_OK; }