Skip to content

Commit

Permalink
Fix overlays detection (tkashkin#291)
Browse files Browse the repository at this point in the history
Former-commit-id: 6498058
  • Loading branch information
tkashkin committed Aug 2, 2019
1 parent d15da78 commit 19dc731
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 14 deletions.
14 changes: 9 additions & 5 deletions src/data/Game.vala
Original file line number Diff line number Diff line change
Expand Up @@ -239,17 +239,21 @@ namespace GameHub.Data
File[] dirs = { install_dir };
if(overlays_enabled)
{
dirs = { install_dir.get_child(FSUtils.GAMEHUB_DIR).get_child("_overlay").get_child("merged") };
dirs += install_dir.get_child(FSUtils.GAMEHUB_DIR).get_child(FSUtils.OVERLAYS_DIR).get_child(Overlay.BASE);
if(from_all_overlays)
{
dirs += install_dir.get_child(FSUtils.GAMEHUB_DIR).get_child(Overlay.BASE);
dirs += install_dir.get_child(FSUtils.GAMEHUB_DIR).get_child("_overlay").get_child("merged");
foreach(var overlay in overlays)
{
if(overlay.id == Overlay.BASE) continue;
dirs += install_dir.get_child(FSUtils.GAMEHUB_DIR).get_child(FSUtils.OVERLAYS_DIR).get_child(overlay.id);
}
}
dirs += install_dir;
mount_overlays.begin();
}
var variables = new HashMap<string, string>();
foreach(var dir in dirs)
{
var variables = new HashMap<string, string>();
variables.set("game_dir", dir.get_path());
var file = FSUtils.file(path, null, variables);
if(file != null && file.query_exists())
Expand Down Expand Up @@ -277,7 +281,7 @@ namespace GameHub.Data
{
dirs = {
install_dir.get_child(FSUtils.GAMEHUB_DIR).get_child("_overlay").get_child("merged"),
install_dir.get_child(FSUtils.GAMEHUB_DIR).get_child(Overlay.BASE),
install_dir.get_child(FSUtils.GAMEHUB_DIR).get_child(FSUtils.OVERLAYS_DIR).get_child(Overlay.BASE),
install_dir
};
}
Expand Down
10 changes: 6 additions & 4 deletions src/data/sources/gog/GOGGame.vala
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ namespace GameHub.Data.Sources.GOG

install_dir = null;
executable_path = "$game_dir/start.sh";

mount_overlays.begin();
update_status();
}

Expand Down Expand Up @@ -137,6 +139,7 @@ namespace GameHub.Data.Sources.GOG
}
}

mount_overlays.begin();
update_status();
}

Expand All @@ -145,9 +148,8 @@ namespace GameHub.Data.Sources.GOG
if(game_info_updating) return;
game_info_updating = true;

update_status();

yield mount_overlays();
update_status();

if(info_detailed == null || info_detailed.length == 0)
{
Expand Down Expand Up @@ -374,8 +376,8 @@ namespace GameHub.Data.Sources.GOG
var state = Game.State.UNINSTALLED;

var gameinfo = get_file("gameinfo", false);
var goggame = get_file(@"goggame-$(id).info", false);
var gh_marker = get_file(@".gamehub_$(id)", false);
var goggame = get_file(@"goggame-$(id).info");
var gh_marker = get_file(@".gamehub_$(id)");

var files = new ArrayList<File>();

Expand Down
6 changes: 4 additions & 2 deletions src/data/sources/humble/HumbleGame.vala
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ namespace GameHub.Data.Sources.Humble
install_dir = null;
executable_path = "$game_dir/start.sh";
info_detailed = @"{\"order\":\"$(order_id)\"}";

mount_overlays.begin();
update_status();
}

Expand Down Expand Up @@ -152,6 +154,7 @@ namespace GameHub.Data.Sources.Humble
}
}

mount_overlays.begin();
update_status();
}

Expand Down Expand Up @@ -181,9 +184,8 @@ namespace GameHub.Data.Sources.Humble
if(game_info_updating) return;
game_info_updating = true;

update_status();

yield mount_overlays();
update_status();

if((icon == null || icon == "") && (info != null && info.length > 0))
{
Expand Down
8 changes: 5 additions & 3 deletions src/data/sources/user/UserGame.vala
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ namespace GameHub.Data.Sources.User
}

((User) source).add_game(this);

mount_overlays.begin();
update_status();
}

Expand Down Expand Up @@ -110,14 +112,14 @@ namespace GameHub.Data.Sources.User
}
}

mount_overlays.begin();
update_status();
}

public override async void update_game_info()
{
update_status();

yield mount_overlays();
update_status();

if(installer == null && info != null && info.length > 0)
{
Expand Down Expand Up @@ -203,7 +205,7 @@ namespace GameHub.Data.Sources.User
{
game_name = game.name;
id = "installer";
platform = installer.get_path().has_suffix(".exe") ? Platform.WINDOWS : Platform.LINUX;
platform = installer.get_path().down().has_suffix(".exe") ? Platform.WINDOWS : Platform.LINUX;
parts.add(new Runnable.Installer.Part("installer", installer.get_uri(), full_size, installer, installer));
}
}
Expand Down

0 comments on commit 19dc731

Please sign in to comment.