示例#1
0
bool DevPakUpdater::ConfigurationValid()
{
    // let's make sure we have a valid configuration
    if (g_MasterPath.IsEmpty() || !wxDirExists(g_MasterPath))
    {
        if (wxMessageBox(_("The Dev-C++ DevPak Plugin is not configured yet.\nDo you want to configure it now?"), _("Question"), wxICON_QUESTION | wxYES_NO) == wxNO)
            return false;
        if (Configure() != 0)
            return false;
        // ask to add in compiler paths
        if (wxMessageBox(_("Do you want to add this path to the compiler's search dirs?\n"
                        "(needed to be able to actually compile anything)"),
                        _("Question"), wxICON_QUESTION | wxYES_NO) == wxYES)
        {
            Compiler* compiler = CompilerFactory::GetCompiler(0); // GCC is always first compiler
            if (!compiler)
            {
                wxMessageBox(_("Invalid compiler!?!"), _("Error"), wxICON_ERROR);
                return true;
            }
            compiler->AddIncludeDir(g_MasterPath + wxFILE_SEP_PATH + _T("include"));
            compiler->AddLibDir(g_MasterPath + wxFILE_SEP_PATH + _T("lib"));
        }
    }
    return true;
}