commandline parameter "homedir" is ignored and with "datadir" the hardcoded defaultdirs were parsed

Bug #615891 reported by Stefan Karpinski
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
widelands
Fix Released
Medium
Unassigned

Bug Description

I have several widelands installations on my system with different config and data directories.
I called widelands with the --homedir and --datadir commandline parameters and find that the --homedir is ignored, the message:
 Adding home directory: $HOME/.widelands_trunk was printed but no config file reading or saving and no game saving in this directory happens. widelands always tries $HOME/.widelands.

With the datadir parameter widelands searches the hard coded default paths like . and /usr/share/games/widelands before the wanted one.

While browsing through the code of src/wlapplication.cc I find a "wrong" order of functions calls and data initialization in the constructor of WLApplication. I'm not a C++ programmer so it was a little bit tricky (trial and error) to realize that m_homedir became a new value but the internal filesystem was not informed about the changes. And even if it would the config file is read before calling handle_commandline_parameters and so the wrong or no config file is found.
The same by m_default_datadirs. The value changed after! the if(m_default_datadirs) and is ignored.

I have to rearrange the code a little bit to get it work.
Maybe you find a better solution but the patch works for me.

Revision history for this message
Stefan Karpinski (stefan-karpinski) wrote :
Revision history for this message
Nasenbaer (nasenbaer) wrote :

the patch seems to be fine for me. Any objections against a merge?

Changed in widelands:
status: New → Confirmed
importance: Undecided → Medium
Revision history for this message
SirVer (sirver) wrote :

+1 for merging

Revision history for this message
Nasenbaer (nasenbaer) wrote :

I committed the patch in revision 5470 -> Fix committed

Changed in widelands:
status: Confirmed → Fix Committed
milestone: none → build16-rc1
Revision history for this message
SirVer (sirver) wrote :

Released in build16-rc1

Changed in widelands:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.