Skip to content

Commit

Permalink
Maybe fix Humble Trove downloads (#429)
Browse files Browse the repository at this point in the history
  • Loading branch information
tkashkin committed Nov 27, 2020
1 parent 1cce940 commit 51dd7c8
Show file tree
Hide file tree
Showing 6 changed files with 244 additions and 168 deletions.
2 changes: 1 addition & 1 deletion src/data/runnables/tasks/install/InstallTask.vala
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ namespace GameHub.Data.Runnables.Tasks.Install

public bool cancelled { get; private set; default = false; }

public InstallTask(Runnable? runnable, ArrayList<Installer>? installers, ArrayList<File>? install_dirs, InstallTask.Mode install_mode=InstallTask.Mode.INTERACTIVE, bool allow_install_dir_import=true)
public InstallTask(Runnable? runnable, ArrayList<Installer>? installers, ArrayList<File>? install_dirs, InstallTask.Mode install_mode = InstallTask.Mode.INTERACTIVE, bool allow_install_dir_import = true)
{
Object(runnable: runnable, installers: installers, install_dirs: install_dirs, install_mode: install_mode, can_import_install_dir: allow_install_dir_import);
}
Expand Down
5 changes: 3 additions & 2 deletions src/data/runnables/tasks/install/Installer.vala
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ namespace GameHub.Data.Runnables.Tasks.Install
if(compat_runnable == null || task.selected_compat_tool == null || !task.selected_compat_tool.can_install(compat_runnable, task)) return false;
yield task.selected_compat_tool.install(compat_runnable, task, file);
return true;
break;

case InstallerType.ARCHIVE:
case InstallerType.WINDOWS_NSIS_INSTALLER:
Expand Down Expand Up @@ -253,6 +252,8 @@ namespace GameHub.Data.Runnables.Tasks.Install
uint current_part = 1;
foreach(var part in parts)
{
debug("[DownloadableInstaller.download] Part %u: `%s`", current_part, part.remote.get_uri());

FS.mkdir(part.local.get_parent().get_path());

var ds_id = Downloader.download_manager().file_download_started.connect(dl => {
Expand Down Expand Up @@ -330,7 +331,7 @@ namespace GameHub.Data.Runnables.Tasks.Install
catch(IOError.CANCELLED e){}
catch(Error e)
{
warning("[DownloadableInstaller.download] %s", e.message);
warning("[DownloadableInstaller.download] Error: %s", e.message);
}
task.status = new InstallTask.Status();
return files;
Expand Down
10 changes: 0 additions & 10 deletions src/data/sources/gog/GOGGame.vala
Original file line number Diff line number Diff line change
Expand Up @@ -435,16 +435,6 @@ namespace GameHub.Data.Sources.GOG
}
}
}

string g = name;
string? d = null;
if(this is DLC)
{
g = ((DLC) this).game.name;
d = name;
}
/*installers_dir = FS.file(FS.Paths.Collection.GOG.expand_installers(g, d));
bonus_content_dir = FS.file(FS.Paths.Collection.GOG.expand_bonus(g, d));*/
}

private bool loading_achievements = false;
Expand Down
49 changes: 49 additions & 0 deletions src/data/sources/humble/Humble.vala
Original file line number Diff line number Diff line change
Expand Up @@ -238,5 +238,54 @@ namespace GameHub.Data.Sources.Humble

return _games;
}

public override ArrayList<File>? game_dirs
{
owned get
{
ArrayList<File>? dirs = null;

var paths = GameHub.Settings.Paths.Humble.instance.game_directories;
if(paths != null && paths.length > 0)
{
foreach(var path in paths)
{
if(path != null && path.length > 0)
{
var dir = FS.file(path);
if(dir != null)
{
if(dirs == null) dirs = new ArrayList<File>();
dirs.add(dir);
}
}
}
}

return dirs;
}
}

public override File? default_game_dir
{
owned get
{
var path = GameHub.Settings.Paths.Humble.instance.default_game_directory;
if(path != null && path.length > 0)
{
var dir = FS.file(path);
if(dir != null && dir.query_exists())
{
return dir;
}
}
var dirs = game_dirs;
if(dirs != null && dirs.size > 0)
{
return dirs.first();
}
return null;
}
}
}
}
Loading

0 comments on commit 51dd7c8

Please sign in to comment.