From 6f50e27b3832f4b2eff8b8d39b5c5eea8996fa59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Sim=C3=B5es?= Date: Mon, 24 Jun 2024 11:05:12 +0100 Subject: [PATCH] JLink operations don't delete files anymore (#282) --- nanoFirmwareFlasher.Library/JLinkCli.cs | 38 ++++++------------------- 1 file changed, 9 insertions(+), 29 deletions(-) diff --git a/nanoFirmwareFlasher.Library/JLinkCli.cs b/nanoFirmwareFlasher.Library/JLinkCli.cs index d2453f85..a7d221a9 100644 --- a/nanoFirmwareFlasher.Library/JLinkCli.cs +++ b/nanoFirmwareFlasher.Library/JLinkCli.cs @@ -138,7 +138,9 @@ public ExitCodes ExecuteFlashBinFiles( { List shadowFiles = []; - var processFileResult = ProcessFilePaths(files, shadowFiles); + var processFileResult = ProcessFilePaths( + files, + shadowFiles); if (processFileResult != ExitCodes.OK) { @@ -280,19 +282,6 @@ public ExitCodes ExecuteFlashBinFiles( Console.ForegroundColor = ConsoleColor.White; - // be nice and clean up shadow files - try - { - foreach (string shadowFile in shadowFiles) - { - File.Delete(shadowFile); - } - } - catch (Exception) - { - // ignore any exception here - } - return ExitCodes.OK; } @@ -308,7 +297,9 @@ public ExitCodes ExecuteFlashHexFiles( { List shadowFiles = []; - var processFileResult = ProcessFilePaths(files, shadowFiles); + var processFileResult = ProcessFilePaths( + files, + shadowFiles); if (processFileResult != ExitCodes.OK) { @@ -421,19 +412,6 @@ public ExitCodes ExecuteFlashHexFiles( Console.ForegroundColor = ConsoleColor.White; - // be nice and clean up shadow files - try - { - foreach (string shadowFile in shadowFiles) - { - File.Delete(shadowFile); - } - } - catch (Exception) - { - // ignore any exception here - } - return ExitCodes.OK; } @@ -521,7 +499,9 @@ internal static string RunJLinkCLI(string cmdFile, string arguments = null) return jlinkCli.StandardOutput.ReadToEnd(); } - private ExitCodes ProcessFilePaths(IList files, List shadowFiles) + private static ExitCodes ProcessFilePaths( + IList files, + List shadowFiles) { // J-Link can't handle diacritc chars // developer note: reported to Segger (Case: 60276735) and can be removed if this is fixed/improved