mirror of
https://github.com/packwiz/packwiz-installer.git
synced 2025-10-16 16:04:32 +02:00
Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
f52cd19ad4 | ||
|
60887a4312 | ||
|
a368268038 | ||
|
8beded7b41 |
@@ -152,6 +152,9 @@ internal class DownloadTask private constructor(val metadata: IndexFile.File, de
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: if already exists and has correct hash, ignore?
|
||||
// TODO: add .disabled support?
|
||||
|
||||
try {
|
||||
val hash: Hash
|
||||
val fileHashFormat: String
|
||||
@@ -176,7 +179,14 @@ internal class DownloadTask private constructor(val metadata: IndexFile.File, de
|
||||
}
|
||||
|
||||
if (fileSource.hashIsEqual(hash)) {
|
||||
// isDirectory follows symlinks, but createDirectories doesn't
|
||||
try {
|
||||
Files.createDirectories(destPath.parent)
|
||||
} catch (e: FileAlreadyExistsException) {
|
||||
if (!Files.isDirectory(destPath.parent)) {
|
||||
throw e
|
||||
}
|
||||
}
|
||||
Files.copy(data.inputStream(), destPath, StandardCopyOption.REPLACE_EXISTING)
|
||||
data.clear()
|
||||
} else {
|
||||
|
@@ -3,6 +3,7 @@ package link.infra.packwiz.installer.ui
|
||||
import link.infra.packwiz.installer.ui.IUserInterface.ExceptionListResult
|
||||
import java.util.concurrent.CompletableFuture
|
||||
import java.util.concurrent.Future
|
||||
import kotlin.system.exitProcess
|
||||
|
||||
class CLIHandler : IUserInterface {
|
||||
override fun handleException(e: Exception) {
|
||||
@@ -40,8 +41,11 @@ class CLIHandler : IUserInterface {
|
||||
}
|
||||
|
||||
override fun showExceptions(exceptions: List<ExceptionDetails>, numTotal: Int, allowsIgnore: Boolean): Future<ExceptionListResult> {
|
||||
val future = CompletableFuture<ExceptionListResult>()
|
||||
future.complete(ExceptionListResult.CANCEL)
|
||||
return future
|
||||
println("Failed to download modpack, the following errors were encountered:")
|
||||
for (ex in exceptions) {
|
||||
println(ex.name + ": ")
|
||||
ex.exception.printStackTrace()
|
||||
}
|
||||
exitProcess(1)
|
||||
}
|
||||
}
|
@@ -180,11 +180,18 @@ class InstallWindow : IUserInterface {
|
||||
override fun showOptions(options: List<IOptionDetails>): Future<Boolean> {
|
||||
val future = CompletableFuture<Boolean>()
|
||||
EventQueue.invokeLater {
|
||||
if (options.isEmpty()) {
|
||||
JOptionPane.showMessageDialog(null,
|
||||
"This modpack has no optional mods!",
|
||||
"Optional mods", JOptionPane.INFORMATION_MESSAGE)
|
||||
future.complete(false)
|
||||
} else {
|
||||
OptionsSelectWindow(options, future, frmPackwizlauncher).apply {
|
||||
defaultCloseOperation = JDialog.DISPOSE_ON_CLOSE
|
||||
isVisible = true
|
||||
}
|
||||
}
|
||||
}
|
||||
return future
|
||||
}
|
||||
|
||||
@@ -201,7 +208,7 @@ class InstallWindow : IUserInterface {
|
||||
|
||||
override fun disableOptionsButton() {
|
||||
btnOptions.apply {
|
||||
text = "Optional mods..."
|
||||
text = "No optional mods"
|
||||
isEnabled = false
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user