cocos2dx lua 路径问题的一个bug (网络整理)

在android手机里运行时,弹出提示Get data from file(aaa/xxx.lua)failed!,我xxx.lua是放在aaa目录下,结果无法获取数据。

  1.  std::string filename(luaL_checkstring(L, 1));
  2.                 std::string strsrc(".");
  3.                 std::string strdst("/");
  4.                 std::string::size_type pos = 0;
  5.                 std::string::size_type srclen = strsrc.size();
  6.                 std::string::size_type dstlen = strdst.size();
  7.                 while( (pos=filename.find(strsrc, pos)) != std::string::npos )
  8.                 {
  9.                         filename.replace( pos, srclen, strdst );
  10.                         pos += dstlen;
  11.                 }
  12.                 filename.append(".lua")
原文地址:https://www.cnblogs.com/wenlove/p/2909311.html