mirror of
https://github.com/corda/corda.git
synced 2024-12-29 09:18:58 +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 {
|
fun saveProfile(): Boolean {
|
||||||
var target = chooser.showSaveDialog(null) ?: return false
|
val target = forceExtension(chooser.showSaveDialog(null) ?: return false, ".zip")
|
||||||
if (target.extension.isEmpty()) {
|
|
||||||
target = File(target.parent, target.name + ".zip")
|
|
||||||
}
|
|
||||||
|
|
||||||
log.info("Save profile as: $target")
|
log.info("Save profile as: $target")
|
||||||
|
|
||||||
val configs = nodeController.activeNodes
|
val configs = nodeController.activeNodes
|
||||||
@ -54,6 +50,10 @@ class ProfileController : Controller() {
|
|||||||
return true
|
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>? {
|
fun openProfile(): List<NodeConfig>? {
|
||||||
val chosen = chooser.showOpenDialog(null) ?: return null
|
val chosen = chooser.showOpenDialog(null) ?: return null
|
||||||
log.info("Selected profile: $chosen")
|
log.info("Selected profile: $chosen")
|
||||||
|
Loading…
Reference in New Issue
Block a user