fix(importer): hardlink fails inside docker

docker does not support hardlinks between different mounts
fallback to copy in that case
This commit is contained in:
Gauthier Roebroeck 2021-04-20 10:04:48 +08:00
parent 7650050fe1
commit 24cf1819b0

View file

@ -85,8 +85,8 @@ class BookImporter(
CopyMode.HARDLINK -> try {
logger.info { "Hardlink file $sourceFile to $destFile" }
Files.createLink(destFile, sourceFile)
} catch (e: UnsupportedOperationException) {
logger.warn { "Filesystem does not support hardlinks, copying instead" }
} catch (e: Exception) {
logger.warn(e) { "Filesystem does not support hardlinks, copying instead" }
sourceFile.copyTo(destFile)
}
}