app#GetAppPath vs. configmanager#DetermineExecutablePath
Why do both these square wheels exist ? Should I just copy/paste ?
They both exist because I did not remove the one in
CodeBlocksApp hastily (not knowing where it might be used). If no other code depends on it (plugins?), we could remove/replace it, but let's not be hasty.
Formerly, the application used to
set app_path at some time during startup. Before this, the value returned by ConfigManager was undefined. That was ugly, but not a big issue because we made sure we didn't use it earlier.
Now, ConfigManager makes user paths dependent on where the config file was found. That means that it does all that path initialising a lot earlier (the first time any ConfigManager function is called) and consequently needs to know
app_path a lot earlier too (and perferrably not depending on the state of startup).
The Linux code in
CodeBlocksApp was not very good anyway, it never really determined a path, but simply assumed "
.", which may accidentially work, but often does not.
The new version tries to read
/proc/self/exe (and falls back to ".") which is not perfect, but a bit better. If you know of a yet better method, please step forward.
And unfortunately wxStandardPathsBase::Get().GetDataDir() seems
to return the wrong result in wx 2.6.3, might bug-report it for 2.8.0.
It's exactly what was used before too, though. Only now we have
if(...) return and before we had
return wxPathList.FindValid(...).
Where does it return a wrong value, MacOS? Works under Windows. Have not tested under Linux myself, but nobody complained during the last 6 weeks...?