Skip to content

Stop writing example.musicxml to the repo root (fixes #150)#154

Merged
webern merged 1 commit into
masterfrom
fix/example-xml-output
May 22, 2026
Merged

Stop writing example.musicxml to the repo root (fixes #150)#154
webern merged 1 commit into
masterfrom
fix/example-xml-output

Conversation

@webern
Copy link
Copy Markdown
Owner

@webern webern commented May 22, 2026

Fixes #150.

The mxwrite example program previously hard-coded its output to
./example.musicxml, which left an untracked file at the repo root
every time examples ran (i.e. for every make test / make test-all
invocation).

Changes

  • src/private/mx/examples/Write.cpp \u2014 mxwrite now accepts an
    optional output path via argv[1], defaulting to
    ./example.musicxml so the README's illustrative path still works
    when a user runs the binary by hand.
  • Makefile \u2014 run_examples now passes
    ./data/testOutput/example.musicxml to mxwrite and ensures the
    directory exists. data/testOutput/ is already gitignored.
  • data/testOutput/.gitignore \u2014 added *.musicxml (it only
    covered *.xml, *.csv, *.txt before).
  • src/private/mxtest/api/DocumentManagerTest.cpp and
    src/private/mxtest/api/RoundTrip.h \u2014 two other writeToFile
    calls that also dumped XML at the repo root (sillytest.xml and
    output.xml) now write into data/testOutput via
    mxtest::getResourcesDirectoryPath().
  • README.md \u2014 the example code snippet matches the updated
    Write.cpp.

Verification

Ran locally:

  • make fmt \u2014 clean
  • make check \u2014 === check passed ===
  • make test-all \u2014 All tests passed (9914 assertions in 2678 test cases)

After the full run, no example.musicxml, example.xml,
sillytest.xml, or output.xml remain at the repo root.

This supersedes #151.

Closes #150.

The mxwrite example program previously hard-coded its output to
"./example.musicxml", which left an untracked file at the repo root
every time examples ran (which happens for every make test/test-all run).

Fixes:
- mxwrite now accepts an optional output path via argv[1] and the
  Makefile's run_examples helper points it at ./data/testOutput/, which
  is already a gitignored directory.
- data/testOutput/.gitignore now also ignores *.musicxml (it only
  covered *.xml / *.csv / *.txt before).
- Two other writeToFile calls that also dumped XML at the repo root
  (DocumentManagerTest.cpp sillytest.xml, RoundTrip.h output.xml) now
  write into data/testOutput via mxtest::getResourcesDirectoryPath().
- README and Write.cpp comments updated to describe the new behavior.

Verified locally with make fmt, make check, and make test-all; no
example.xml/example.musicxml/sillytest.xml/output.xml are left at the
repo root after the run.
@webern webern merged commit f96e22f into master May 22, 2026
4 of 5 checks passed
@webern webern deleted the fix/example-xml-output branch May 22, 2026 11:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Stop writing example.xml to the root of the repo.

1 participant