我用的是
auto aa = FileUtils::getInstance()->fullPathForFilename(“aaa”);
log("lj::%s",aa.c_str());
DIR* dirp;
struct dirent* direntp;
dirp = opendir( aa.c_str() );
if( dirp != NULL ) {
for(;;) {
direntp = readdir( dirp );
if( direntp == NULL ) break;
printf( "%s\n", direntp->d_name );
}
closedir( dirp );
return;
}
在XCODE IOS下能获取到 aaa文件夹内的所有文件名称 输出如下
cocos2d: lj::/Users/yawnsan/Library/Application Support/iPhone Simulator/7.1/Applications/E1447A68-A7CE-421E-8180-540DA3319DEC/animationDemo iOS.app/aaa
.
…
red.png
sprite.png
编译成安卓以后就这样了
09-01 16:23:54.165: D/cocos2d-x debug info(31757): cocos2d: fullPathForFilename: No file found at aaa. Possible missing file.
09-01 16:23:54.165: D/cocos2d-x debug info(31757): lj::aaa
跪求大神知道 IOS 跟 安卓通用的获取 文件名的方法!