Unvanquished / updater

QML based updater to install, update and launch the Unvanquished game.
https://unvanquished.net/download
15 stars 7 forks source link

Do not hardcode ~/.local/share, use [~/.config]/unvanquished/updater.conf path, etc. #13

Closed illwieckz closed 6 years ago

illwieckz commented 7 years ago

Do not hardcode ~/.local/share

Do not merge it so fast, because the default directories can be modified See https://github.com/Unvanquished/Unvanquished/issues/730#issuecomment-312753551

illwieckz commented 7 years ago

I don't know how to test the .desktop and icon installation.

illwieckz commented 6 years ago

I just added a commit to migrate previous game's homepath from ~/.unvanquished to ~/.local/share/unvanquished (or any custom XDG_DATA_HOME variation) to prevent the updater to create an empty destination directory before the engine try to migrate them itself.

Note that the code is called when defaultInstallPath() is called, hence you have to remove ~/.config/unvanquished/updater.conf first to see the migration happening if this file already exists. The ~/.config/unvanquished/updater.conf path is introduced by a former commit of this PR, so it does not exist on user's filesystem yet (unless you have yourself built and run older commits from this PR) so it's not an issue at all: once this PR will be merged and once people will run the updater containing this code for the first time, the game's homepath will be migrated then the config file will be written accordingly.

This PR must be the very last one to be merged before release.

slipher commented 6 years ago

Why does there need to be path migration code in bot the updater and the engine? Why not just one or the other?

illwieckz commented 6 years ago

@Slipher The engine has to do the path migration because not everyone will use the updater. The engine does the migration if ~/.local/share/unvanquished does not exist yet.

On the other hand the updater fetches files from cdn, stores them in ~/.local/share/unvanquished/base (and create parents if they do not exist yet) then runs the engine, so when the updater runs the engine the ~/.local/share/unvanquished path already exists in all case and the engine will never do the migration.

That's why both: at every entry point.

illwieckz commented 6 years ago

Note that if we were using ~/.local/share/unvanquished/base for install files stored by updater and something like ~/.local/share/unvanquished/user/ for user's files only the engine would have to know how to do the migration. But other people were not happy with that idea (and that makes sense to not be happy with that idea).