void ConsoleHistory::Save() { std::ofstream l_File(c_Filename); if (l_File.is_open()) { for (const std::string& l_Cmd : m_Cmds) { l_File << l_Cmd << "\n"; } } else { LOG("Could not open " << c_Filename, "console", Error); } }
void ConsoleHistory::Load() { std::ifstream l_File(c_Filename); if (l_File.is_open()) { std::string l_Line; while (std::getline(l_File, l_Line)) { m_Cmds.push_back(l_Line); } if (m_Cmds.size() > m_uiMaxSize) { m_Cmds.erase(m_Cmds.begin() + (m_uiMaxSize - 1), m_Cmds.end() - 1); LOG("History file contained " << m_Cmds.size() << " commands, was truncated to " << m_Cmds.size(), "console", Warning); } LOG("Read " << m_Cmds.size() << " commands from " << c_Filename, "console", Debug); } else { LOG("Could not open " << c_Filename, "console", Debug); } }
cbMGMakefile::cbMGMakefile( cbProject* ppProject, const wxString& pFileName, bool pOverwrite,bool pSilence,bool pAllTargets) : m_Objs() , m_CommandPrefix( _T( '\t' ) ) , m_CommandPrefixRepeatCnt( 1 ) , m_pProj( ppProject ) , m_Filename( pFileName ) , m_Path( _T("") ) , m_IsSilence( pSilence ) , m_Overwrite( pOverwrite ) , m_AllTargets( pAllTargets ) , m_VariablesIsSaved( false ) , m_ProceedTargets( _T("") ) , m_DependenciesIsNotExistsIsNoProblem( false ) { //ctor m_Path = m_pProj->GetBasePath(); #ifdef USE_PRINTLOG wxTextFile l_File( g_FileName ); if( l_File.Exists() ) { if( l_File.Open() ) { l_File.Clear(); l_File.Write(); l_File.Close(); } } else if( l_File.Create() ) { l_File.AddLine( _T( "# Start log" ) ); l_File.Write(); l_File.Close(); } printLog( _T( "cbMGMakeFile::cbMGMakeFile" ), m_Path ); #endif }