Skip to content

Commit 6f50e27

Browse files
authored
JLink operations don't delete files anymore (#282)
1 parent 4e6c5c3 commit 6f50e27

File tree

1 file changed

+9
-29
lines changed

1 file changed

+9
-29
lines changed

nanoFirmwareFlasher.Library/JLinkCli.cs

Lines changed: 9 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,9 @@ public ExitCodes ExecuteFlashBinFiles(
138138
{
139139
List<string> shadowFiles = [];
140140

141-
var processFileResult = ProcessFilePaths(files, shadowFiles);
141+
var processFileResult = ProcessFilePaths(
142+
files,
143+
shadowFiles);
142144

143145
if (processFileResult != ExitCodes.OK)
144146
{
@@ -280,19 +282,6 @@ public ExitCodes ExecuteFlashBinFiles(
280282

281283
Console.ForegroundColor = ConsoleColor.White;
282284

283-
// be nice and clean up shadow files
284-
try
285-
{
286-
foreach (string shadowFile in shadowFiles)
287-
{
288-
File.Delete(shadowFile);
289-
}
290-
}
291-
catch (Exception)
292-
{
293-
// ignore any exception here
294-
}
295-
296285
return ExitCodes.OK;
297286
}
298287

@@ -308,7 +297,9 @@ public ExitCodes ExecuteFlashHexFiles(
308297
{
309298
List<string> shadowFiles = [];
310299

311-
var processFileResult = ProcessFilePaths(files, shadowFiles);
300+
var processFileResult = ProcessFilePaths(
301+
files,
302+
shadowFiles);
312303

313304
if (processFileResult != ExitCodes.OK)
314305
{
@@ -421,19 +412,6 @@ public ExitCodes ExecuteFlashHexFiles(
421412

422413
Console.ForegroundColor = ConsoleColor.White;
423414

424-
// be nice and clean up shadow files
425-
try
426-
{
427-
foreach (string shadowFile in shadowFiles)
428-
{
429-
File.Delete(shadowFile);
430-
}
431-
}
432-
catch (Exception)
433-
{
434-
// ignore any exception here
435-
}
436-
437415
return ExitCodes.OK;
438416
}
439417

@@ -521,7 +499,9 @@ internal static string RunJLinkCLI(string cmdFile, string arguments = null)
521499
return jlinkCli.StandardOutput.ReadToEnd();
522500
}
523501

524-
private ExitCodes ProcessFilePaths(IList<string> files, List<string> shadowFiles)
502+
private static ExitCodes ProcessFilePaths(
503+
IList<string> files,
504+
List<string> shadowFiles)
525505
{
526506
// J-Link can't handle diacritc chars
527507
// developer note: reported to Segger (Case: 60276735) and can be removed if this is fixed/improved

0 commit comments

Comments
 (0)