Skip to content

Commit

Permalink
JLink operations don't delete files anymore (#282)
Browse files Browse the repository at this point in the history
  • Loading branch information
josesimoes authored Jun 24, 2024
1 parent 4e6c5c3 commit 6f50e27
Showing 1 changed file with 9 additions and 29 deletions.
38 changes: 9 additions & 29 deletions nanoFirmwareFlasher.Library/JLinkCli.cs
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,9 @@ public ExitCodes ExecuteFlashBinFiles(
{
List<string> shadowFiles = [];

var processFileResult = ProcessFilePaths(files, shadowFiles);
var processFileResult = ProcessFilePaths(
files,
shadowFiles);

if (processFileResult != ExitCodes.OK)
{
Expand Down Expand Up @@ -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;
}

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

var processFileResult = ProcessFilePaths(files, shadowFiles);
var processFileResult = ProcessFilePaths(
files,
shadowFiles);

if (processFileResult != ExitCodes.OK)
{
Expand Down Expand Up @@ -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;
}

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

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

0 comments on commit 6f50e27

Please sign in to comment.