Skip to content
This repository was archived by the owner on Apr 19, 2025. It is now read-only.

Commit 65e6af9

Browse files
committed
Maybe fix Humble Trove downloads (#429)
Former-commit-id: 51dd7c8
1 parent c93eb2e commit 65e6af9

File tree

6 files changed

+244
-168
lines changed

6 files changed

+244
-168
lines changed

src/data/runnables/tasks/install/InstallTask.vala

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ namespace GameHub.Data.Runnables.Tasks.Install
4545

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

48-
public InstallTask(Runnable? runnable, ArrayList<Installer>? installers, ArrayList<File>? install_dirs, InstallTask.Mode install_mode=InstallTask.Mode.INTERACTIVE, bool allow_install_dir_import=true)
48+
public InstallTask(Runnable? runnable, ArrayList<Installer>? installers, ArrayList<File>? install_dirs, InstallTask.Mode install_mode = InstallTask.Mode.INTERACTIVE, bool allow_install_dir_import = true)
4949
{
5050
Object(runnable: runnable, installers: installers, install_dirs: install_dirs, install_mode: install_mode, can_import_install_dir: allow_install_dir_import);
5151
}

src/data/runnables/tasks/install/Installer.vala

+3-2
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,6 @@ namespace GameHub.Data.Runnables.Tasks.Install
9292
if(compat_runnable == null || task.selected_compat_tool == null || !task.selected_compat_tool.can_install(compat_runnable, task)) return false;
9393
yield task.selected_compat_tool.install(compat_runnable, task, file);
9494
return true;
95-
break;
9695

9796
case InstallerType.ARCHIVE:
9897
case InstallerType.WINDOWS_NSIS_INSTALLER:
@@ -253,6 +252,8 @@ namespace GameHub.Data.Runnables.Tasks.Install
253252
uint current_part = 1;
254253
foreach(var part in parts)
255254
{
255+
debug("[DownloadableInstaller.download] Part %u: `%s`", current_part, part.remote.get_uri());
256+
256257
FS.mkdir(part.local.get_parent().get_path());
257258

258259
var ds_id = Downloader.download_manager().file_download_started.connect(dl => {
@@ -330,7 +331,7 @@ namespace GameHub.Data.Runnables.Tasks.Install
330331
catch(IOError.CANCELLED e){}
331332
catch(Error e)
332333
{
333-
warning("[DownloadableInstaller.download] %s", e.message);
334+
warning("[DownloadableInstaller.download] Error: %s", e.message);
334335
}
335336
task.status = new InstallTask.Status();
336337
return files;

src/data/sources/gog/GOGGame.vala

-10
Original file line numberDiff line numberDiff line change
@@ -435,16 +435,6 @@ namespace GameHub.Data.Sources.GOG
435435
}
436436
}
437437
}
438-
439-
string g = name;
440-
string? d = null;
441-
if(this is DLC)
442-
{
443-
g = ((DLC) this).game.name;
444-
d = name;
445-
}
446-
/*installers_dir = FS.file(FS.Paths.Collection.GOG.expand_installers(g, d));
447-
bonus_content_dir = FS.file(FS.Paths.Collection.GOG.expand_bonus(g, d));*/
448438
}
449439

450440
private bool loading_achievements = false;

src/data/sources/humble/Humble.vala

+49
Original file line numberDiff line numberDiff line change
@@ -238,5 +238,54 @@ namespace GameHub.Data.Sources.Humble
238238

239239
return _games;
240240
}
241+
242+
public override ArrayList<File>? game_dirs
243+
{
244+
owned get
245+
{
246+
ArrayList<File>? dirs = null;
247+
248+
var paths = GameHub.Settings.Paths.Humble.instance.game_directories;
249+
if(paths != null && paths.length > 0)
250+
{
251+
foreach(var path in paths)
252+
{
253+
if(path != null && path.length > 0)
254+
{
255+
var dir = FS.file(path);
256+
if(dir != null)
257+
{
258+
if(dirs == null) dirs = new ArrayList<File>();
259+
dirs.add(dir);
260+
}
261+
}
262+
}
263+
}
264+
265+
return dirs;
266+
}
267+
}
268+
269+
public override File? default_game_dir
270+
{
271+
owned get
272+
{
273+
var path = GameHub.Settings.Paths.Humble.instance.default_game_directory;
274+
if(path != null && path.length > 0)
275+
{
276+
var dir = FS.file(path);
277+
if(dir != null && dir.query_exists())
278+
{
279+
return dir;
280+
}
281+
}
282+
var dirs = game_dirs;
283+
if(dirs != null && dirs.size > 0)
284+
{
285+
return dirs.first();
286+
}
287+
return null;
288+
}
289+
}
241290
}
242291
}

0 commit comments

Comments
 (0)