1
0
mirror of https://github.com/fadden/6502bench.git synced 2024-11-29 10:50:28 +00:00

Update project file formatting

No meaningful change to the format itself, just to the way it's
formatted.  Specifically, we now emit a line break after every
comma rather than only at curly braces.

The problem driving this change is that all end-of-line comments
are stored in a single dictionary, which becomes a single long line.
Most source control tools can't diff or merge that in a useful way.
Having every element on its own line makes some things harder to
read, but in the end I'm more interested in machine readability
than human readability.

(I tested this by saving all SGTestData projects and verifying that
they worked.  I didn't check the updated versions in because it's
kind of nice to have older project files around to confirm that I'm
not breaking backward compatibility.)
This commit is contained in:
Andy McFadden 2019-12-31 13:59:08 -08:00
parent f157fbbfd3
commit 160dfca42a
3 changed files with 5 additions and 3 deletions

View File

@ -116,9 +116,9 @@ namespace CommonUtil {
/// messing with the quoted items. Assumes that quoted quotes (backslash-quote) only
/// appear inside quoted text.
/// </summary>
/// <param name="inStr"></param>
/// <param name="findStr"></param>
/// <param name="repStr"></param>
/// <param name="inStr">Input string.</param>
/// <param name="findStr">Substring to find.</param>
/// <param name="repStr">If string found, replace with this.</param>
public static string NonQuoteReplace(string inStr, string findStr, string repStr) {
// There's probably a better way to do this...
StringBuilder sb = new StringBuilder(inStr.Length + inStr.Length / 20);

View File

@ -1126,6 +1126,7 @@ namespace SourceGen {
mProject = newProject;
mProjectPathName = mProject.ProjectPathName = projPathName;
mDataPathName = dataPathName;
FinishPrep();
}

View File

@ -75,6 +75,7 @@ namespace SourceGen {
// much more useful.
serializedData = TextUtil.NonQuoteReplace(serializedData, "{", "{\r\n");
serializedData = TextUtil.NonQuoteReplace(serializedData, "},", "},\r\n");
serializedData = TextUtil.NonQuoteReplace(serializedData, ",", ",\r\n");
}
// Check to see if the project file is read-only. We want to fail early