]> git.tdb.fi Git - libs/gui.git/commitdiff
Use FS::extpart for checking filename extension
authorMikko Rasa <tdb@tdb.fi>
Sat, 27 Aug 2011 19:24:04 +0000 (22:24 +0300)
committerMikko Rasa <tdb@tdb.fi>
Sat, 27 Aug 2011 19:24:04 +0000 (22:24 +0300)
source/graphics/image.cpp

index 6a20178c5d4a5d115ed1748100374d13a3e03f38..5d2a21bb66e969d85da76f34811d4ff5e1f9836b 100644 (file)
@@ -1,6 +1,7 @@
 #ifdef WITH_DEVIL
 #include <IL/il.h>
 #endif
 #ifdef WITH_DEVIL
 #include <IL/il.h>
 #endif
+#include <msp/fs/utils.h>
 #include <msp/io/file.h>
 #include <msp/io/memory.h>
 #include "image.h"
 #include <msp/io/file.h>
 #include <msp/io/memory.h>
 #include "image.h"
@@ -46,8 +47,9 @@ Image::~Image()
 
 void Image::load_file(const string &fn)
 {
 
 void Image::load_file(const string &fn)
 {
+       string ext = FS::extpart(fn);
 #ifdef WITH_LIBPNG
 #ifdef WITH_LIBPNG
-       if(fn.size()>4 && !fn.compare(fn.size()-4, 4, ".png"))
+       if(ext==".png")
        {
                IO::BufferedFile file(fn);
                load_png(file, *priv);
        {
                IO::BufferedFile file(fn);
                load_png(file, *priv);