mirror of
https://github.com/TermoraDev/termora.git
synced 2026-01-16 02:12:58 +08:00
fix: background image selection failure
This commit is contained in:
@@ -22,8 +22,7 @@ class BackgroundManager private constructor() {
|
||||
fun setBackgroundImage(file: File) {
|
||||
synchronized(this) {
|
||||
try {
|
||||
|
||||
bufferedImage = ImageIO.read(file)
|
||||
bufferedImage = file.inputStream().use { ImageIO.read(it) }
|
||||
imageFilepath = file.absolutePath
|
||||
appearance.backgroundImage = file.absolutePath
|
||||
|
||||
|
||||
@@ -59,6 +59,7 @@ import java.awt.event.ItemListener
|
||||
import java.io.File
|
||||
import java.net.URI
|
||||
import java.nio.charset.StandardCharsets
|
||||
import java.nio.file.StandardCopyOption
|
||||
import java.util.*
|
||||
import java.util.function.Consumer
|
||||
import javax.swing.*
|
||||
@@ -276,7 +277,8 @@ class SettingsOptionsPane : OptionsPane() {
|
||||
try {
|
||||
val destFile = FileUtils.getFile(Application.getBaseDataDir(), "background", file.name)
|
||||
FileUtils.forceMkdirParent(destFile)
|
||||
FileUtils.copyFile(file, destFile)
|
||||
FileUtils.deleteQuietly(destFile)
|
||||
FileUtils.copyFile(file, destFile, StandardCopyOption.REPLACE_EXISTING)
|
||||
backgroundImageTextField.text = destFile.name
|
||||
BackgroundManager.getInstance().setBackgroundImage(destFile)
|
||||
} catch (e: Exception) {
|
||||
|
||||
Reference in New Issue
Block a user