title: How To Get File In Assets From Android NDK
body: <p>I'm trying to access an image file in the assets folder from the native side. Now I can successfully search through the assets folder and its subdirectories locating the particular file that I am looking for:</p>
  
  <pre><code>AAssetDir* assetDir = AAssetManager_openDir(asset_manager, "images");
  const char* filename;
  while ((filename = AAssetDir_getNextFileName(assetDir)) != NULL)
  {
     __android_log_print(ANDROID_LOG_DEBUG, "Debug", filename);
  }
  
  AAssetDir_close(assetDir);
  </code></pre>
  
  <p>I am also using OSG. I set the image as a texture to my shader with the following code:</p>
  
  <pre><code>texture-&gt;setImage(osgDB::readImageFile(fileNameWithPath));
  </code></pre>
  
  <p>But that file name must include the absolute path as well since it is not located in the same directory. However I found out that I cannot get the absolute path for the assets directory, being that it is compressed along with the APK.</p>
  
  <p>Being that I can't access the absolute path, what other way could I use to get the image? Also to note, I do want to keep the files in the asset folder as appose to the sd card.</p>