Skip to content

Commit

Permalink
Merge pull request #691 from uni-bremen-agst/delete-files-created-by-…
Browse files Browse the repository at this point in the history
…tests

Delete files created by tests.
  • Loading branch information
koschke authored Jan 25, 2024
2 parents 8c4dcd9 + 13f8612 commit c6f3b8d
Show file tree
Hide file tree
Showing 6 changed files with 299 additions and 203 deletions.
1 change: 0 additions & 1 deletion Assets/SEE/DataModel/DG/IO/GraphWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ public static void Save(string filename, Graph graph, string hierarchicalEdgeTyp
Debug.LogError($"Could not save graph to GXL file '{filename}' due to: {e.Message}.\n");
throw;
}
Debug.Log($"Successfully saved graph to file '{filename}'!");
}

/// <summary>
Expand Down
17 changes: 15 additions & 2 deletions Assets/SEE/Utils/FileIO.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public static class FileIO
/// <param name="fromLine">the start of the requested line range</param>
/// <param name="toLine">the end of the requested line range</param>
/// <returns>file content in the specified line range</returns>
public static string Read(string fileName, int fromLine, int toLine)
internal static string Read(string fileName, int fromLine, int toLine)
{
UnityEngine.Assertions.Assert.IsTrue(fromLine > 0 && fromLine <= toLine);

Expand All @@ -49,5 +49,18 @@ public static string Read(string fileName, int fromLine, int toLine)
}
return result.ToString();
}

/// <summary>
/// If a file named <paramref name="filename"/> exists, it will be deleted.
/// If it does not exist, nothing happens.
/// </summary>
/// <param name="filename">file to be deleted</param>
internal static void DeleteIfExists(string filename)
{
if (File.Exists(filename))
{
File.Delete(filename);
}
}
}
}
}
Loading

0 comments on commit c6f3b8d

Please sign in to comment.