Code::Blocks Forums

Developer forums (C::B DEVELOPMENT STRICTLY!) => Plugins development => Topic started by: mariocup on May 24, 2007, 11:56:03 am

Title: Compiler Search Dirs are overwritten using cfg->Read
Post by: mariocup on May 24, 2007, 11:56:03 am
Hi,

if a compiler is added in plugins\compilergcc and the include dirs are set to empty in AutoDetectResult:

        AddIncludeDir(wxEmptyString);
        AddLibDir(wxEmptyString);
        AddResourceIncludeDir(wxEmptyString);

then codeblocks will show empty search dirs for this  compiler (in the settings/compiler and debugger) at the first start. Then codeblocks write the configuration file default.conf in APPDATA when closing codeblocks.
If codeblocks is started again, then the default.conf is read and in sdk/compiler.gcc the settings are overwritten in

Code
void Compiler::LoadSettings(const wxString& baseKey)
...
    SetIncludeDirs(GetArrayFromString(cfg->Read(tmp + _T("/include_dirs"), m_MasterPath + sep + _T("include"))));
    SetResourceIncludeDirs(GetArrayFromString(cfg->Read(tmp + _T("/res_include_dirs"), m_MasterPath + sep + _T("include"))));
    SetLibDirs(GetArrayFromString(cfg->Read(tmp + _T("/library_dirs"), m_MasterPath + sep + _T("lib"))));

I think if the entry in default.conf does not exists for the compiler or is empty it should be left empty.

    SetIncludeDirs(GetArrayFromString(cfg->Read(tmp + _T("/include_dirs"), wxEmptyString)));


Bye,

Mario
Title: Re: Compiler Search Dirs are overwritten using cfg->Read
Post by: mandrav on May 24, 2007, 12:23:51 pm
Hi Mario,

Quote
if a compiler is added in plugins\compilergcc and the include dirs are set to empty in AutoDetectResult:

        AddIncludeDir(wxEmptyString);
        AddLibDir(wxEmptyString);
        AddResourceIncludeDir(wxEmptyString);

You should avoid adding empty dirs (this may have to do with the other bug you posted where there was a stray -I in the command line). If you don't want any dirs added then don't add any.

Quote
I think if the entry in default.conf does not exists for the compiler or is empty it should be left empty.

    SetIncludeDirs(GetArrayFromString(cfg->Read(tmp + _T("/include_dirs"), wxEmptyString)));

You have a point here. It will be corrected.