I'm building an Android app with C++ library, and I have a problem with sending file path.
I have my JNI function in jni/processing.cpp :
JNIEXPORT jfloat JNICALL Java_com_my_package_path_getMyFunction
(JNIEnv *env, jobject obj, jstring param) {
string str = env->GetStringUTFChars(param, 0);
string filePath = "src/textfile/";
return getResult(str, filePath);
}
and getResult() is a member function of jni/src/library/myclass.cpp.
I have several text files under jni/src/textfiles/, and I want to send this path to getResult() function as a parameter. Since processing.cpp is in jni/ folder, I set path as src/textfile/, but it doesn't work. (getResult() function can't find the path)
I've been tried filePath = "../../textfile/" which is relative path from jni/src/library/myclass.cpp, and it also doesn't work.
However, all my other JNI functions (not using file path) are working fine.
Is there anyone who can help? Should I use absolute path? Then, how can I get it?