GetFilesDir() from NDK?

前端 未结 2 1431
盖世英雄少女心
盖世英雄少女心 2020-12-07 01:08

Is there a way to get the application\'s directory to save private data to a file for my application directly from the NDK? In other words, I need an equivalent of the Java

相关标签:
2条回答
  • 2020-12-07 01:29

    I have custom helper class for accessing various paths, for the data directory I do this:

    1. Read /proc/self/cmdline or /proc/**MyPID**/cmdline
    2. Append the results from #1 to /data/data/

    Example results:

    /data/data/com.yourcompany.yourproduct/
    
    0 讨论(0)
  • 2020-12-07 01:43

    If you are using NativeActivity then you have access from native code to an ANativeActivity instance (see <ndk_root>/platforms/android-9/arch-arm/usr/include/android/native_activity.h) which has internalDataPath and externalDataPath members.

    0 讨论(0)
提交回复
热议问题