swick/openmw — comment on commit 16c214a17af6c4506d89bad139a4d66e7423f180
File:  line 0
By lgromanowski:

Hi,
currently forum is down (network reconfiguration :| ), so I put my comments it here (I hope you don't mind):

"[quote="swick"]Did the same thing for linux. It should find the "Installed Path" in wine:
https://github.com/swick/openmw/commit/16c214a17af6c4506d89bad139a4d66e7423f180[/quote]

Idea inside this commit is good, but I have few comments about the code:
- would you change the code so it would not contain multiple returns?
- line.length() check could be moved from two places to just one, i.e
[code]
while (...)
{
if (line.length() > 0) {
if (line[0] == ...) {
}
else if () {
}
}

...
}
[/code]
- instead of line.length() you could use just line.empty()

- boost/filesystem/fstream.hpp header should be moved from linuxpath.hpp into linuxpath.cpp

- regkey comparision with "SOFTWARE\Wow..." and SOFTWARE\Bethesda..." could be simplified to
comparision with "\\\\Bethesda Softworks\\\\Morrowind"

- startPos, pos variables should have type std::string::size_type, and they should be moved to the scope of "if(key.compare("Installed Path") == 0)"

- do-while loop in if (key.compare(...) == 0) scope could be replaced with:
std::replace( installPath.begin(), installPath.end(), '\\', '/' ); //std::replace is in header
"