Author Topic: Compiler Search Dirs are overwritten using cfg->Read  (Read 2573 times)

Offline mariocup

  • Developer
  • Lives here!
  • *****
  • Posts: 587
Compiler Search Dirs are overwritten using cfg->Read
« 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: [Select]
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

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4291
    • Code::Blocks IDE
Re: Compiler Search Dirs are overwritten using cfg->Read
« Reply #1 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.
Be patient!
This bug will be fixed soon...