Example #1
0
bool nuiTranslator::SaveLanguage(const nglPath& rOutputLanguageFile) const
{
  nglOStream* pStream = rOutputLanguageFile.OpenWrite(true);
  bool res = SaveLanguage(pStream);
  delete pStream;
  return res;
}
Example #2
0
bool ProjectGenerator::GenerateFile(const nglPath& src, const nglPath& dst)
{
  uint32 srcsize = (uint32)src.GetSize();
  
  nglIStream* pFile = src.OpenRead();
  if (!pFile)
  {
    nglString msg;
    msg.Format(_T("reading input file '%ls'"), src.GetChars());
    return MsgError(msg);
  }

  char* str = new char[srcsize + 1];
  pFile->Read(str, srcsize, 1);
  str[srcsize] = 0;
  delete pFile;
  
  nglString contents(str);
  contents.Replace(_T("TemplateApp"), mProjectName);
  contents.Replace(_T("../../../nui3"), mNuiRelativeSource.GetPathName());

  
  nglOStream* poFile = dst.OpenWrite(false);
  if (!poFile)
  {
    nglString msg;
    msg.Format(_T("writing output file '%ls'"), dst.GetChars());
    return MsgError(msg);
  }

  char* ptr = contents.Export();
  
  poFile->Write(ptr, contents.GetLength(), 1);
  delete poFile;
  if (ptr)
    free(ptr);

  NGL_OUT(_T("nui project generator : generated '%ls'\n"), dst.GetChars());
  return true;
}
Example #3
0
nuiZipWriter::nuiZipWriter(const nglPath& rPath, CreateFlag flag)
: mpStream(rPath.OpenWrite(flag == OverWrite)), mOwnStream(true), mpZip(NULL)
{
  Open(flag);
}