Skip to content

Commit

Permalink
Merge branch 'ms5' into 'alpha'
Browse files Browse the repository at this point in the history
ZIP-archive changes

See merge request Griefed/ServerPackCreator!519
  • Loading branch information
Griefed committed Sep 7, 2023
2 parents 4e0ae8e + e2107d2 commit 7399228
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -830,16 +830,23 @@ actual class ConfigurationHandler(
SecurityException::class
)
actual override fun getDirectoriesInModpackZipBaseDirectory(zipFile: File): List<String> {
val baseDirectories: MutableList<String> = ArrayList(100)
val baseDirectories: TreeSet<String> = TreeSet()
var headerBeginning: String
ZipFile(zipFile).use {
val headers = it.fileHeaders
for (header in headers) {
if (header.fileName.matches(zipCheck)) {
baseDirectories.add(header.fileName)
try {
headerBeginning = header.fileName.substring(0,header.fileName.indexOfFirst { char -> char == '/' } + 1)
log.debug("Header beginning $headerBeginning")
if (headerBeginning.matches(zipCheck)) {
baseDirectories.add(headerBeginning)
}
} catch (ex: StringIndexOutOfBoundsException) {
log.debug("Could not parse ${header.fileName}")
}
}
}
return baseDirectories
return baseDirectories.toList()
}

@Throws(IOException::class)
Expand Down
2 changes: 2 additions & 0 deletions serverpackcreator-gui/src/main/i18n/Gui_en_GB.properties
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,8 @@ createserverpack.gui.inclusions.editor.tip.default=Select an entry on the left t
createserverpack.gui.inclusions.editor.tip.global.inclusions=Global inclusion filters do not have any effect on the server pack generation.
createserverpack.gui.inclusions.editor.tip.global.exclusions=This global exclusion filter would exclude anything matching: {0}
createserverpack.gui.inclusions.editor.tip.prefix=The following files would be included with this Inclusion-Specification:\n
createserverpack.gui.config.zip.info.title=Generating from ZIP-archive
createserverpack.gui.config.zip.info.message=Server packs from ZIP-archives always contain your specified files, plus automatically determined ones based on the ZIP-archive contents.
migration.message.title=Things Have Been Migrated!
menubar.gui.migration=Migration Info
menubar.gui.filetoolarge=Size exceeds 10MB or 400.000 characters in length.\nMust be smaller than 10MB and 400.000 characters\nfor HasteBin upload.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,14 @@ class ControlPanel(
}

if (!apiWrapper.configurationHandler!!.checkConfiguration(packConfig, encounteredErrors, true)) {
if (activeTab.getModpackDirectory().endsWith(".zip",ignoreCase = true)) {
JOptionPane.showMessageDialog(
panel.parent,
Gui.createserverpack_gui_config_zip_info_message.toString(),
Gui.createserverpack_gui_config_zip_info_title.toString(),
JOptionPane.INFORMATION_MESSAGE
)
}
log.info("Config check passed.")
statusPanel.updateStatus(Gui.createserverpack_log_info_buttoncreateserverpack_checked.toString())
generateServerPack(packConfig)
Expand Down

0 comments on commit 7399228

Please sign in to comment.