mirror of
https://github.com/copyrighttxt/watrbx-game-engine.git
synced 2026-09-06 05:37:48 +00:00
GEEKING
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
#include "JNIUtil.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
#include <jni.h>
|
||||
|
||||
namespace RBX
|
||||
{
|
||||
namespace JNI
|
||||
{
|
||||
std::string cacheDirectory;
|
||||
std::string assetFolderPath;
|
||||
|
||||
std::string jstringToStdString(JNIEnv *jenv, jstring jstrName)
|
||||
{
|
||||
jboolean isCopy;
|
||||
const char *nativeString = jenv->GetStringUTFChars(jstrName, &isCopy);
|
||||
const size_t kLength = strlen(nativeString)+1;
|
||||
char *cstr = new char[kLength];
|
||||
strncpy(cstr, nativeString, kLength);
|
||||
if (isCopy)
|
||||
{
|
||||
jenv->ReleaseStringUTFChars(jstrName, nativeString);
|
||||
}
|
||||
|
||||
std::string str = cstr;
|
||||
delete [] cstr;
|
||||
return str;
|
||||
}
|
||||
} // JNI
|
||||
} // RBX
|
||||
Reference in New Issue
Block a user