Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,12 @@ endef

# Run the three example programs from the given mode dir ($1). The test
# targets run these too, so the examples are exercised everywhere tests run.
# mxwrite is told to write into data/testOutput so we don't leave an untracked
# example.musicxml at the repo root (issue #150).
define run_examples
@mkdir -p data/testOutput
$(call run_bin,$(1),mxread,)
$(call run_bin,$(1),mxwrite,)
$(call run_bin,$(1),mxwrite,./data/testOutput/example.musicxml)
$(call run_bin,$(1),mxhide,)
endef

Expand Down
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -301,8 +301,10 @@ int main(int argc, const char * argv[])
std::cout << std::endl;
#endif

// write to a file
mgr.writeToFile( documentID, "./example.musicxml" );
// write to a file. argv[1] overrides the default output path so the build
// system can send the file to a gitignored location (see issue #150).
const std::string outputPath = ( argc > 1 ) ? argv[1] : "./example.musicxml";
mgr.writeToFile( documentID, outputPath );

// we need to explicitly delete the object held by the manager
mgr.destroyDocument( documentID );
Expand Down
1 change: 1 addition & 0 deletions data/testOutput/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
*.csv
*.musicxml
*.txt
*.xml
7 changes: 5 additions & 2 deletions src/private/mx/examples/Write.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,11 @@ int main(int argc, const char *argv[])
std::cout << std::endl;
#endif

// write to a file
mgr.writeToFile(documentID, "./example.musicxml");
// write to a file. argv[1] overrides the default output path so the build
// system can send the file to a gitignored location during automated runs;
// see issue #150.
const std::string outputPath = (argc > 1) ? argv[1] : "./example.musicxml";
mgr.writeToFile(documentID, outputPath);

// we need to explicitly delete the object held by the manager
mgr.destroyDocument(documentID);
Expand Down
4 changes: 3 additions & 1 deletion src/private/mxtest/api/DocumentManagerTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,9 @@ TEST( sillyTest, DocumentManager )
score.encoding.encodingDate.day = 30;
score.copyright = "© 2016 by Matthew James Briggs";
auto documentId = DocumentManager::getInstance().createFromScore( score );
DocumentManager::getInstance().writeToFile( documentId, "./sillytest.xml" );
const std::string sillyOutputPath = mxtest::getResourcesDirectoryPath() + "testOutput" +
mxtest::FILE_PATH_SEPARATOR + "sillytest.xml";
DocumentManager::getInstance().writeToFile( documentId, sillyOutputPath );
DocumentManager::getInstance().destroyDocument( documentId );
}
T_END
Expand Down
4 changes: 3 additions & 1 deletion src/private/mxtest/api/RoundTrip.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include "mx/api/DocumentManager.h"
#include "mxtest/control/CompileControl.h"
#include "mxtest/file/MxFileRepository.h"
#include "mxtest/file/Path.h"
#include <sstream>

namespace mxtest
Expand All @@ -21,7 +22,8 @@ inline void roundTrip()
auto scoreData = docMgr.getData(docId);
docMgr.destroyDocument(docId);
docId = docMgr.createFromScore(scoreData);
docMgr.writeToFile(docId, "./output.xml");
const std::string outputPath = getResourcesDirectoryPath() + "testOutput" + FILE_PATH_SEPARATOR + "output.xml";
docMgr.writeToFile(docId, outputPath);
docMgr.destroyDocument(docId);
}

Expand Down
Loading