From 7d3f004ae36bd94a746e62ee198577fbcf7b289e Mon Sep 17 00:00:00 2001 From: Zlatin Balevsky Date: Mon, 29 Aug 2022 12:08:51 +0100 Subject: [PATCH] set path to shared parent when loading downloaded files too --- .../com/muwire/core/files/BasePersisterService.groovy | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/core/src/main/groovy/com/muwire/core/files/BasePersisterService.groovy b/core/src/main/groovy/com/muwire/core/files/BasePersisterService.groovy index 4904fff1..fb1c2c33 100644 --- a/core/src/main/groovy/com/muwire/core/files/BasePersisterService.groovy +++ b/core/src/main/groovy/com/muwire/core/files/BasePersisterService.groovy @@ -102,6 +102,10 @@ abstract class BasePersisterService extends Service{ publishedTimestamp = json.publishedTimestamp } + Path path = null + if (json.pathToSharedParent != null) + path = Path.of(json.pathToSharedParent) + if (json.sources != null) { List sources = (List)json.sources Set sourceSet = sources.stream().map({ d -> new Destination(d.toString())}).collect Collectors.toSet() @@ -109,12 +113,10 @@ abstract class BasePersisterService extends Service{ if (published) df.publish(publishedTimestamp) df.setComment(json.comment) + df.setPathToSharedParent(path) return new FileLoadedEvent(loadedFile : df, infoHash: ih) } - Path path = null - if (json.pathToSharedParent != null) - path = Path.of(json.pathToSharedParent) SharedFile sf = new SharedFile(file, ih.getRoot(), pieceSize) sf.setPathToSharedParent(path)