Example #1
0
void CConfiguration::SaveToFile(const CString& FileName)
{
 FILE *stream = fopen(FileName.GetCString(),"wt");
 for (size_t i = 0; i < m_Variables.size(); i++)
 {
  CVariable *variable = m_Variables[i];
  CString string = variable->GetName()+"=";
  if ((variable->GetType()==VARIABLE_TYPE_STRING)||
      (variable->GetType()==VARIABLE_TYPE_CHAR))
  { string+="\""+variable->GetString()+"\""; }
  else
  { string+=variable->GetString(); }
  string.Append(';').AppendEOL();
  fwrite(string.GetCString(),string.GetLength(),1,stream);
 }
 fclose(stream);
}
Example #2
0
bool CCodeBlocksBuildManager::LoadProjectOrWorkspace(const CString& FileName)
{
    bool result = false;
    TiXmlDocument cbpw;
    result = cbpw.LoadFile(FileName.GetCString());
    if (!result) return false;
    Clear();
    const TiXmlElement *root = cbpw.RootElement();
    if (0==strcmp(root->Value(),"CodeBlocks_project_file")) {
        m_Project.Read(root);
        m_ProjectLoaded = true;
        result = true;
    } else if (0==strcmp(root->Value(),"CodeBlocks_workspace_file")) {
        m_Workspace.Read(root);
        m_Workspace.LoadWorkspaceProjects(ExtractFilePath(FileName));
        m_WorkspaceLoaded = true;
        result = true;
    }
    return result;
}