From 12f61b03ef3868c1b6c422bbee6e736448e18ee1 Mon Sep 17 00:00:00 2001 From: dankito Date: Mon, 27 Jul 2020 16:58:29 +0200 Subject: [PATCH] Moved mkdirs() to getFints4kClientDataFile() --- .../kotlin/net/dankito/banking/fints4kBankingClient.kt | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/ui/fints4kBankingClient/src/commonMain/kotlin/net/dankito/banking/fints4kBankingClient.kt b/ui/fints4kBankingClient/src/commonMain/kotlin/net/dankito/banking/fints4kBankingClient.kt index de320557..cfb33281 100644 --- a/ui/fints4kBankingClient/src/commonMain/kotlin/net/dankito/banking/fints4kBankingClient.kt +++ b/ui/fints4kBankingClient/src/commonMain/kotlin/net/dankito/banking/fints4kBankingClient.kt @@ -176,8 +176,6 @@ open class fints4kBankingClient( try { val clientDataFile = getFints4kClientDataFile() - clientDataFile.parent?.mkdirs() - serializer.serializeObject(fints4kCustomer, clientDataFile) } catch (e: Exception) { log.error("Could not save customer data for $fints4kCustomer", e) @@ -185,7 +183,11 @@ open class fints4kBankingClient( } protected open fun getFints4kClientDataFile(): File { - return File(File(dataFolder, "fints4k-client"), "${bank.bankCode}_${fints4kCustomer.customerId}_$fints4kClientDataFilename") + val folder = File(dataFolder, "fints4k-client") + + folder.mkdirs() + + return File(folder, "${bank.bankCode}_${fints4kCustomer.customerId}_$fints4kClientDataFilename") }