简体   繁体   中英

[android ndk]How can I get absoulte path of files in asset folder?

I'm using ftgles library on android native app.

but i can't rendering a text.

this is my source code.

unsigned char* buff;
unsigned long size;

buff = GLManager::getInstance()->texture()->loadFontFromAssets("NanumGothic.ttf", &size);

font = new FTBufferFont(buff, size);

I think this code is wrong.

so I'm trying to

change this code

font = new FTBufferFont(buff, size);

to

font = new FTBufferFont("filePath");

but I don't know the absolute path of assets folder's file

could you teach me how to get assets folder's file absolute path?

Assets are not files, and you cannot use fopen() for them, which FTBufferFont(const char*) does under the hood. But you can extract an asset to a regular file if you wish, especially if you need this for debugging your code.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM