title: FreeImage_GetFileType not working in Android NDK
body: <p>I am currently trying to create a multiplatform application (targets are Windows and Android via ndk).
  So the problem is in textures (as in topic of this post). It works great on windows, but in Android <code>FreeImage_GetFileType</code> returns <code>FIF_UNKNOWN</code>, despite the fact that I can read part of .png file manually from same file path (only PNG file magic, beceause then it contains some null bytes).
  I use them this way (only part connected to this issue):</p>
  
  <pre><code>Texture::Texture(std::string fpath)
  :Resource(fpath)            //Resource makes fpath=/storage/emulated/0/+...+/+fpath (via reference)
  {
      std::ifstream file(fpath);
      if(!file){           //this isnt fired both on android and windows (so it can find this file)
          std::cout &lt;&lt; "[error]: couldn't open " &lt;&lt; fpath &lt;&lt; "\n";
          #ifdef ANDROID
          LOGI("[error]: couldn't open %s", fpath.c_str());
          #endif // ANDROID
      }
  
      std::string textureStr = std::string((std::istreambuf_iterator&lt;char&gt;(file)),
      std::istreambuf_iterator&lt;char&gt;());
      #ifdef ANDROID      /*this also works nice, prints 
      /storage/emulated/0/external_sd/Android/data/package/textures/textureUV.png
      and �PNG
      */
      LOGI("loading image: %s as %s", fpath.c_str(), textureStr.c_str());
      #else
      std::cout &lt;&lt; "loading image " &lt;&lt; fpath &lt;&lt; ", " &lt;&lt; textureStr.c_str() &lt;&lt; "\n";
      #endif // ANDROID
      file.close();
      batchId = textureCounter;
  
      glGenTextures(1, &amp;id);
      bind(GL_TEXTURE_2D);
  
      FREE_IMAGE_FORMAT format = FreeImage_GetFileType(fpath.c_str(), 0);
      if(format == FIF_UNKNOWN) {     //this one is triggered on Android only
          #ifdef ANDROID
          LOGI("Failed to read format %s", fpath.c_str());
          #endif // ANDROID
          std::cout &lt;&lt; "Failed to read format @ " &lt;&lt; fpath.c_str() &lt;&lt; "\n";
      }
      if(format == FIF_UNKNOWN)       //this one is triggered on Android only too 
          format = FreeImage_GetFIFFromFilename(fpath.c_str());
      if(format == FIF_UNKNOWN) {    //and this one is triggered on Android only too 
          #ifdef ANDROID
          LOGI("Failed to read format v2 %s", fpath.c_str());
          #endif // ANDROID
          std::cout &lt;&lt; "Failed to read format v2 @ " &lt;&lt; fpath.c_str() &lt;&lt; "\n";
      }
  </code></pre>
  
  <p>So, why is it working on Windows but not on Android?
  By the way, I have read/write access in AndroidManifest, and the textures are placed in assets folder and then extracted to sd card using AAsetManager from java (it is all before native code gets executed). I can also see thaht textures are stored correctly using <code>adb shell cat /storage/emulated/0/external_sd/Android/data/package/textures/textureUV.png</code> which prints the png file.</p>
  
  <p>And I have to add that I have built FreeImage from source to static library. I made some changes (mosly about arm/neon stuff). But I have even tried some others people build of this library (from Linderdaum engine) with same effect (not working images type detection).</p>