Compare commits

..

2 Commits

Author SHA1 Message Date
comp500
46771ce870 Clarify error message for missing index file 2021-07-16 04:07:45 +01:00
comp500
b143f67acd Fix symlink check by catching the correct exception 2021-06-22 13:54:06 +01:00
2 changed files with 3 additions and 4 deletions

View File

@@ -183,7 +183,7 @@ internal class DownloadTask private constructor(val metadata: IndexFile.File, de
// isDirectory follows symlinks, but createDirectories doesn't
try {
Files.createDirectories(destPath.parent)
} catch (e: FileAlreadyExistsException) {
} catch (e: java.nio.file.FileAlreadyExistsException) {
if (!Files.isDirectory(destPath.parent)) {
throw e
}

View File

@@ -21,7 +21,6 @@ import link.infra.packwiz.installer.ui.IUserInterface.ExceptionListResult
import link.infra.packwiz.installer.ui.data.InstallProgress
import link.infra.packwiz.installer.util.Log
import link.infra.packwiz.installer.util.ifletOrErr
import link.infra.packwiz.installer.util.ifletOrWarn
import okio.buffer
import java.io.FileNotFoundException
import java.io.FileReader
@@ -29,7 +28,6 @@ import java.io.FileWriter
import java.io.IOException
import java.nio.file.Files
import java.nio.file.Paths
import java.util.*
import java.util.concurrent.CompletionService
import java.util.concurrent.ExecutionException
import java.util.concurrent.ExecutorCompletionService
@@ -194,7 +192,8 @@ class UpdateManager internal constructor(private val opts: Options, val ui: IUse
handleCancellation()
}
try {
ifletOrWarn(pf.index, "No index file found") { index ->
// TODO: switch to OkHttp for better redirect handling
ui.ifletOrErr(pf.index, "No index file found, or the pack file is empty; note that Java doesn't automatically follow redirects from HTTP to HTTPS (and may cause this error)") { index ->
ui.ifletOrErr(index.hashFormat, index.hash, "Pack has no hash or hashFormat for index") { hashFormat, hash ->
ui.ifletOrErr(getNewLoc(opts.downloadURI, index.file), "Pack has invalid index file: " + index.file) { newLoc ->
processIndex(