From 59493782951e6a60f30911a3fecdcc5bb758a0e8 Mon Sep 17 00:00:00 2001 From: Scott Wierschem Date: Thu, 12 Dec 2024 16:48:48 -0600 Subject: [PATCH] - F ReporterThatCreatesAnApprovalScript for Linux --- .../reporters/ReporterThatCreatesAnApprovalScript.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/approvaltests/src/main/java/org/approvaltests/reporters/ReporterThatCreatesAnApprovalScript.java b/approvaltests/src/main/java/org/approvaltests/reporters/ReporterThatCreatesAnApprovalScript.java index f8244d6b..4c31b746 100644 --- a/approvaltests/src/main/java/org/approvaltests/reporters/ReporterThatCreatesAnApprovalScript.java +++ b/approvaltests/src/main/java/org/approvaltests/reporters/ReporterThatCreatesAnApprovalScript.java @@ -27,7 +27,10 @@ private static void initializeFile() { } private static void initializeLinux() { - + scriptFile = new File(ApprovedFileLog.APPROVAL_TEMP_DIRECTORY + "/" + fileName + ".sh"); + FileUtils.createIfNeeded(scriptFile.getAbsolutePath()); + FileUtils.writeFile(scriptFile, "#!/bin/bash\n"); + scriptFile.setExecutable(true); } private static void initializeWindows() { @@ -39,7 +42,7 @@ private static void initializeWindows() { @Override public boolean report(String received, String approved) { String commandLine = ClipboardReporter.getCommandLine(received, approved); - FileUtils.appendToFile(scriptFile, commandLine + "\r\n"); + FileUtils.appendToFile(scriptFile, commandLine + "\n"); return true; } }