mirror of
https://github.com/corda/corda.git
synced 2024-12-28 00:38:55 +00:00
CORPRIV-661: Refactor code for guaranteeing a .zip extension.
This commit is contained in:
parent
0f73b68d39
commit
31843bbac8
@ -34,11 +34,7 @@ class ProfileController : Controller() {
|
||||
}
|
||||
|
||||
fun saveProfile(): Boolean {
|
||||
var target = chooser.showSaveDialog(null) ?: return false
|
||||
if (target.extension.isEmpty()) {
|
||||
target = File(target.parent, target.name + ".zip")
|
||||
}
|
||||
|
||||
val target = forceExtension(chooser.showSaveDialog(null) ?: return false, ".zip")
|
||||
log.info("Save profile as: $target")
|
||||
|
||||
val configs = nodeController.activeNodes
|
||||
@ -54,6 +50,10 @@ class ProfileController : Controller() {
|
||||
return true
|
||||
}
|
||||
|
||||
private fun forceExtension(target: File, ext: String): File {
|
||||
return if (target.extension.isEmpty()) File(target.parent, target.name + ext) else target
|
||||
}
|
||||
|
||||
fun openProfile(): List<NodeConfig>? {
|
||||
val chosen = chooser.showOpenDialog(null) ?: return null
|
||||
log.info("Selected profile: $chosen")
|
||||
|
Loading…
Reference in New Issue
Block a user