if (m_Project)
wxSetWorkingDirectory(m_Project->GetBasePath());
CompilerFactory::GetCompiler(m_CompilerId)->Init(m_Project);
It is generally not a good idea to put the if and the statement it controls on the same line, it makes the code harder to read.I generally agree. But in this very case I want to make clear that I'm using another call to CompilerFactory. This can visually be easy compared because it stands in the same alignment as within the line above.
You should also lump the return -1 in with the same if() and not use 2. Unless there is some reason for this?Yes, there is a reason, of course -> the second if statement might not be issued if the first one already returns a valid compiler. But if this is not the case the second if statement is triggered. How would you do that? In the end if both fail we have to return without success. I guess don't understand.
but if i open a project at 1st, then close this project. Now, open a single file, all is fine in this time .I am aware of that. The reason is that m_CompilerId is a member variable that is properly set once you have opened a project. It is initialised by then so if you open a single file after a project the call to CompilerFactory::GetCompiler(m_CompilerId) will succeed.
Edit: This just came into my mind: CompilerFactory::GetDefaultCompilerID() and CompilerFactory::GetDefaultCompiler() could both return and empty string, too!!! This should be taken into account, so the "return default compiler instead" proposal may not be a good solution eigther...?!
but but but but, I can delete the internal compilers (without touching the source code) ...... :twisted: :twisted: :twisted:
[EDIT] : or at least some part of such a compiler
LOLbut but but but, I can delete the internal compilers (without touching the source code) ...... :twisted: :twisted: :twisted:
[EDIT] : or at least some part of such a compiler
Hmm, when I go to compiler options, the "Delete" button is disabled :)
If you 're talking about editing the .conf manually, then it wouldn't work still. It would auto-detect the missing compiler again on next startup ;). But then again, if you manually edit configuration files, you 're on your own :twisted: