void Init(void* infoPtr)
	{
        JNIInitInfo* initInfo = static_cast<JNIInitInfo*>(infoPtr);
        MB_ASSERT(infoPtr);
        g_assetManager = AAssetManager_fromJava(initInfo->env, initInfo->assetManager);
        MB_ASSERT(g_assetManager);
        MB_LOGINFO("Platform::Init complete");
	}
Exemple #2
0
    bool insertEdge(int iv1, int iv2, int fid)
    {
      MB_ASSERT(iv1!=iv2);

      Edge eg(iv1, iv2);

      super_t::iterator iter = super_t::find(eg);

      if (iter==end()) {
        eg.if1 = fid;
        eg.if2 = -1;
	super_t::insert(eg);
        return true;
      }

      if (iter->if2!=-1) {
        MB_DPRINTLN("insertEdge error iv=(%d,%d)", iv1, iv2);
        return false;
      }

      //iter->if2 = fid;
      eg.if1 = iter->if1;
      eg.if2 = fid;

      super_t::erase(iter);
      super_t::insert(eg);

      return false;
    }
  bool fillCbuf()
  {
    int nCurSize = m_cbuf.size();
    int nToFill = m_nCbufLen - nCurSize;
    MB_ASSERT(nToFill>=0);
    if (nToFill==0) return true;
    int i;
    for (i=0; i<nToFill; ++i) {
      if (!fillOne())
        return false;
    }

    return true;
  }
 ILogicalFile* File_OpenOSFile(const char* filepath, E_FileMode mode)
 {
     MB_ASSERT(mode == E_FileMode_ReadBinary);
     
     FILE* handle = fopen(filepath, "rb");
     if (handle)
     {
         File* f = new File();
         f->m_impl->handle = handle;
         return f;
     }
     
     return NULL;
 }
Exemple #5
0
LString makeAbsolutePath(const LString &aRel, const LString &aBase)
{
  MB_DPRINTLN("makeAbsPath rel=%s, base=%s", aRel.c_str(), aBase.c_str());

  fs::path relpath(aRel.c_str());
  fs::path basepath(aBase.c_str());
  if (relpath.is_complete())
    return aRel; // aRel is already in abs form

  // convert to the absolute representation

  fs::path::const_iterator iter1 = relpath.begin();
  fs::path::const_iterator iter1_end = relpath.end();

  int nup = 0;
  for (; iter1!=iter1_end; ++iter1) {
    if (*iter1=="..")
      ++nup;
    else
      break;
  }

  if (nup==0) {
    // There's no up-dir ('..') string --> just concat to make abs path.
#if (BOOST_FILESYSTEM_VERSION==2)
    relpath = fs::complete(relpath, basepath);
    return relpath.file_string();
#else
    relpath = fs::absolute(relpath, basepath);
    return relpath.string();
#endif
  }

  for (; nup>0; --nup) {
    MB_ASSERT(basepath.has_parent_path());
    basepath = basepath.parent_path();
  }
  
  for (; iter1!=iter1_end; ++iter1) {
    basepath /= *iter1;
  }

#if (BOOST_FILESYSTEM_VERSION==2)
  return basepath.file_string();
#else
  return basepath.string();
#endif
}
Exemple #6
0
static void FilterAndAppendFilepathArray(const Platform::FileInfo& fileInfo, void* data)
{
	BuildFileListCtx* ctx = static_cast<BuildFileListCtx*>(data);
	MB_ASSERT(ctx);

	//Ignore hidden unix files.
	if (fileInfo.filename.c_str()[0] == '.')
		return;

	//Ignore hidden files
	if (fileInfo.attributes.hidden)
		return;

    
	if (!StringWildcardMatch(fileInfo.filename.c_str(), fileInfo.filename.GetLength(), ctx->pattern.c_str(), ctx->pattern.GetLength()))
	{
		//No match
		return;
	}
		
	FilePath dirAndFilename = fileInfo.parentDir;
	dirAndFilename.Join(fileInfo.filename);

	//An ugly little hack to avoid breaking some build systems that don't understand ./ syntax under some circumstances.
	//MSVC seems to have issues.
	const char* fp = dirAndFilename.c_str();
	if (strstr(fp, "./") == fp)
	{
		fp += 2;
		ctx->filePathArray->push_back(fp);
	}
	else
	{
		ctx->filePathArray->push_back(dirAndFilename.c_str());
	}
    
    //MB_LOGINFO("%s", fileInfo.fullPath.c_str());
}
Exemple #7
0
 LVariant &at(int n) {
   MB_ASSERT(n<m_nSize);
   return m_data[n];
 }
 void File::Close()
 {
     MB_ASSERT(m_impl->handle);
     fclose(m_impl->handle);
 }
Exemple #9
0
 void end() {
   MB_ASSERT(m_pQdfIn!=NULL);
   m_pQdfIn->end();
   delete m_pQdfIn;
   m_pQdfIn = NULL;
 }