aboutsummaryrefslogtreecommitdiffstats
path: root/utils/src/main/java/org
diff options
context:
space:
mode:
authorliamfallon <liam.fallon@est.tech>2020-01-22 17:51:26 +0000
committerliamfallon <liam.fallon@est.tech>2020-01-22 17:51:30 +0000
commitb4f69e428f1677339ff432c27e2cb8bfa756114e (patch)
tree2730e2d03dd4817c16e7a7212ac899f666699809 /utils/src/main/java/org
parentc22d70d8f2429747ac7eb991c8d83aa3be633d1b (diff)
Create path to text file being created
If you try and write to a file where part of the pat does not exist, that path should be created. Issue-ID: POLICY-1581 Change-Id: Ifb7a4ff4e1804814b6679956f0c58d5ac026c4a4 Signed-off-by: liamfallon <liam.fallon@est.tech>
Diffstat (limited to 'utils/src/main/java/org')
-rw-r--r--utils/src/main/java/org/onap/policy/common/utils/resources/TextFileUtils.java4
1 files changed, 4 insertions, 0 deletions
diff --git a/utils/src/main/java/org/onap/policy/common/utils/resources/TextFileUtils.java b/utils/src/main/java/org/onap/policy/common/utils/resources/TextFileUtils.java
index 5aeacf26..01af7fd8 100644
--- a/utils/src/main/java/org/onap/policy/common/utils/resources/TextFileUtils.java
+++ b/utils/src/main/java/org/onap/policy/common/utils/resources/TextFileUtils.java
@@ -62,6 +62,10 @@ public abstract class TextFileUtils {
*/
public static void putStringAsTextFile(final String outString, final String textFilePath) throws IOException {
final File textFile = new File(textFilePath);
+ if (!textFile.getParentFile().exists()) {
+ textFile.getParentFile().mkdirs();
+ }
+
putStringAsFile(outString, textFile);
}