From 0ee8383644a276cc94990586dd8ce0f52d9e158b Mon Sep 17 00:00:00 2001 From: az Date: Mon, 28 Mar 2022 21:16:54 +0200 Subject: [PATCH] fix fileContentLargeFile for home dir ~/ --- .../provs/framework/ubuntu/filesystem/base/Filesystem.kt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/kotlin/org/domaindrivenarchitecture/provs/framework/ubuntu/filesystem/base/Filesystem.kt b/src/main/kotlin/org/domaindrivenarchitecture/provs/framework/ubuntu/filesystem/base/Filesystem.kt index e3d6ed8..2152d97 100644 --- a/src/main/kotlin/org/domaindrivenarchitecture/provs/framework/ubuntu/filesystem/base/Filesystem.kt +++ b/src/main/kotlin/org/domaindrivenarchitecture/provs/framework/ubuntu/filesystem/base/Filesystem.kt @@ -183,9 +183,10 @@ fun Prov.fileContentLargeFile(file: String, sudo: Boolean = false, chunkSize: In var resultString: String? = null do { - // todo : file paths starting with ~/ are not yet supported + // file paths starting with ~/ are not yet supported + val fileCleaned = if (file.length >= 2 && file.take(2) == "~/") file.substring(2) else file val chunkResult = - cmdNoEval(prefixWithSudo("dd if=\"$file\" iflag=skip_bytes,count_bytes,fullblock bs=\"$chunkSize\" skip=\"$offset\" count=\"$chunkSize\" status=none | base64", sudo)) + cmdNoEval(prefixWithSudo("dd if=\"$fileCleaned\" iflag=skip_bytes,count_bytes,fullblock bs=\"$chunkSize\" skip=\"$offset\" count=\"$chunkSize\" status=none | base64", sudo)) // check first chunk if (resultString == null) {