Skip to content

Commit

Permalink
fix: Compare list- and file-settings more reliably
Browse files Browse the repository at this point in the history
  • Loading branch information
Griefed committed Sep 24, 2023
1 parent 0719385 commit 3d695ae
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import java.awt.event.ActionListener
import java.io.File
import java.net.MalformedURLException
import java.net.URL
import java.util.*
import javax.swing.DefaultComboBoxModel
import javax.swing.JFileChooser
import javax.swing.JOptionPane
Expand Down Expand Up @@ -359,10 +360,10 @@ class GlobalSettings(
apiProperties.homeDirectory = homeSetting.file.absoluteFile
apiProperties.javaPath = javaSetting.file.absolutePath
apiProperties.serverPacksDirectory = serverPacksSetting.file.absoluteFile
apiProperties.zipArchiveExclusions.addAll(zipSetting.text.replace(", ",",").split(","))
apiProperties.directoriesToInclude.addAll(inclusionsSetting.text.replace(", ",",").split(","))
apiProperties.zipArchiveExclusions = TreeSet(zipSetting.text.replace(", ",",").split(","))
apiProperties.directoriesToInclude = TreeSet(inclusionsSetting.text.replace(", ",",").split(","))
apiProperties.aikarsFlags = aikarsSetting.text
apiProperties.scriptTemplates.addAll(scriptSetting.text.replace(", ",",").split(",").map { File(it) })
apiProperties.scriptTemplates = TreeSet(scriptSetting.text.replace(", ",",").split(",").map { File(it).absoluteFile })
apiProperties.updateUrl = URL(fallbackURLSetting.text)
apiProperties.exclusionFilter = exclusionSetting.selectedItem as ExclusionFilter
apiProperties.language = languageSetting.selectedItem as Locale
Expand Down Expand Up @@ -436,9 +437,9 @@ class GlobalSettings(
* @author Griefed
*/
override fun hasUnsavedChanges(): Boolean {
val changes = homeSetting.file != apiProperties.homeDirectory.absoluteFile ||
javaSetting.file != File(apiProperties.javaPath).absoluteFile ||
serverPacksSetting.file != apiProperties.serverPacksDirectory.absoluteFile ||
val changes = homeSetting.file.absolutePath != apiProperties.homeDirectory.absolutePath ||
javaSetting.file.absolutePath != File(apiProperties.javaPath).absolutePath ||
serverPacksSetting.file.absolutePath != apiProperties.serverPacksDirectory.absolutePath ||
zipSetting.text != apiProperties.zipArchiveExclusions.joinToString(", ") ||
inclusionsSetting.text != apiProperties.directoriesToInclude.joinToString(", ") ||
aikarsSetting.text != apiProperties.aikarsFlags ||
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -320,12 +320,12 @@ class WebserviceSettings(
* @author Griefed
*/
override fun hasUnsavedChanges(): Boolean {
val changes = artemisDataDirectorySetting.file != apiProperties.artemisDataDirectory.absoluteFile ||
val changes = artemisDataDirectorySetting.file.absolutePath != apiProperties.artemisDataDirectory.absolutePath ||
artemisQueueMaxDiskUsageSetting.value != apiProperties.artemisQueueMaxDiskUsage ||
databaseFileSetting.file != apiProperties.serverPackCreatorDatabase.absoluteFile ||
databaseFileSetting.file.absolutePath != apiProperties.serverPackCreatorDatabase.absolutePath ||
cleanupScheduleSetting.text != apiProperties.webserviceCleanupSchedule ||
logDirectorySetting.file != apiProperties.tomcatLogsDirectory.absoluteFile ||
baseDirSetting.file != apiProperties.tomcatBaseDirectory.absoluteFile ||
logDirectorySetting.file.absolutePath != apiProperties.tomcatLogsDirectory.absolutePath ||
baseDirSetting.file.absolutePath != apiProperties.tomcatBaseDirectory.absolutePath ||
versionScheduleSetting.text != apiProperties.webserviceVersionSchedule ||
databaseCleanupScheduleSetting.text != apiProperties.webserviceDatabaseCleanupSchedule
if (changes) {
Expand Down

0 comments on commit 3d695ae

Please sign in to comment.