do not migrate legacy homepath when using -homepath arg#59
do not migrate legacy homepath when using -homepath arg#59illwieckz merged 1 commit intoDaemonEngine:for-0.51.0from
Conversation
2ee1fc1 to
1e1c30c
Compare
|
I think it should actually do what the description says, which is to not migrate if the -homepath arg is specified (rather than not migrating if some string compares equal). |
|
Also, you can see the compiler errors by following the Travis links. |
|
Hmm, or perhaps we have to rewrite the description according to the behavior? Currently the code tries to find a legacy homepath to migrate it if the current homepath is the default one, even if the current homepath is the default one because of an useless The question is: does it make sense to not migrate the legacy homepath ( If it does not makes sense to not migrate the legacy homepath if Daemon is using the xdg one (because being set by default or explicitly set, this behavior is acceptable and the description has to be updated. Otherwise if we want to disable the homepath migration as soon as there is one explicit |
|
If you use the |
|
I'm not sure to have understood the question… 😮
|
|
Sorry, my previous comment didn't quite make sense. But it results in inconsistent behavior to use a string comparison on the filename, since you can refer to the same path by multiple spellings. It's not that big of a deal if a hacky string comparison is used, assuming this is temporary code we're going to delete after the next release. On the other hand, it's not much effort to check whether the argument was actually set, considering that |
|
Oh yes now I understand what your are talking about, and it also brings to my mind the issue we can have with symlinks (and @IngarKCT is known to symlink So, it probably far better to check for the presence of that switch than relying on hacky string comparison.
Yeah, that's also why I prefer having this code in a dedicated function we can drop easily (unlike the first attempt). |
|
Updated the PR with a “if -homepath not in cmdline args then migrate” behavior. |
|
You can sidestep the build issue by turning off precompiled headers. |
|
I'm now able to build and test and the code works as expected on my end. |
|
As with Unvanquished/updater#13, I'm generally not happy with including one-time-use migration code if it can be avoided. In this case it seems that it cannot, but you might want to create an On a sidenote, both branches and tags that are unvanquished-specific should says so in their name, e.g. |
The bug is obvious:
In #20 (see also #39) I modified
DefaultHomePath()insrc/common/FileSystem.cppto move legacy homepath to XDG's.local/share/unvanquishedpath (or to follow XDG env vars). ButDefaultHomePath()is called incmdlineArgs_tinitialization insrc/engine/framework/System.cppandcmdlineArgsis initialized inParseCmdline()insrc/engine/framework/System.cppbefore-homepathswitch is parsed. So, the engine try to do the default homepath move even if an arbitrary homepath is forced by command line. Which is wrong.This fix is an attempt to fix that this way:
DefaultHomePath()only returns the xdgpath, socmdlineArgscan be initialized without doing the legacy homepath move;MigrateHomePath()function was created to do the homepath move (if engine built for linux) to be called byFS::Initialize();MigrateHomePath()only do the move ifcmdLineArgs.homePathequalsdefaultHomePath(it means another path was not enforced) so it means the move will not be done if a custom homepath is set.I'm currently unable to build the engine, so if someone can build and test it would be very cool. By the way it does not prevent to have a first look at the code to tell if something is obviously wrong. 😛