Skip to content

Commit b40bc74

Browse files
authored
Merge pull request #1296 from lairworks/useFindInParents
Simplify data mounting in test and demo projects
2 parents 9038194 + 01a7e42 commit b40bc74

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

demoGraphics/DemoGraphics.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ namespace
1919

2020
NAS2D::Font getFont()
2121
{
22-
static const std::string fileName = "../../../data/fonts/opensans.ttf";
22+
static const std::string fileName = "fonts/opensans.ttf";
2323

2424
const auto& filesystem = NAS2D::Utility<NAS2D::Filesystem>::get();
2525
if (filesystem.exists(fileName))
@@ -55,7 +55,6 @@ DemoGraphics::~DemoGraphics()
5555
eventHandler.mouseMotion().disconnect({this, &DemoGraphics::onMouseMove});
5656
eventHandler.mouseButtonDown().disconnect({this, &DemoGraphics::onMouseDown});
5757
eventHandler.keyDown().disconnect({this, &DemoGraphics::onKeyDown});
58-
5958
}
6059

6160
void DemoGraphics::initialize()

demoGraphics/main.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ int main()
2727
try
2828
{
2929
NAS2D::Game game("NAS2D Graphics Test", "NAS2D_GraphicsTest", "LairWorks");
30+
game.mountFindFromBase("demoGraphics/data/");
3031
game.go(new DemoGraphics());
3132
}
3233
catch(std::exception& e)

makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ $(TESTOBJS): $(TESTINTDIR)/%.o : $(TESTDIR)/%.cpp $(TESTINTDIR)/%.dep
133133

134134
.PHONY: check
135135
check: | test
136-
cd test && $(RunPrefix) ../$(TESTOUTPUT) $(GTEST_OPTIONS) $(RunSuffixUnitTest)
136+
$(RunPrefix) $(TESTOUTPUT) $(GTEST_OPTIONS) $(RunSuffixUnitTest)
137137

138138

139139
## Graphics demo project ##
@@ -161,7 +161,7 @@ $(DEMOGRAPHICSOBJS): $(DEMOGRAPHICSINTDIR)/%.o : $(DEMOGRAPHICSDIR)/%.cpp $(DEMO
161161

162162
.PHONY: run-demoGraphics
163163
run-demoGraphics: | demoGraphics
164-
cd demoGraphics/ && $(RunPrefix) ../$(DEMOGRAPHICSOUTPUT) ; cd ..
164+
$(RunPrefix) $(DEMOGRAPHICSOUTPUT)
165165

166166

167167
## Compile rules ##

test/Filesystem.test.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ namespace {
4646
fs(AppName, OrganizationName)
4747
{
4848
fs.mount(fs.basePath());
49-
fs.mount("data/");
49+
fs.mount(fs.findInParents("test/data/", fs.basePath()));
5050
fs.mountReadWrite(fs.prefPath());
5151
}
5252

@@ -153,7 +153,7 @@ TEST_F(Filesystem, isDirectoryMakeDirectory) {
153153
}
154154

155155
TEST_F(Filesystem, mountUnmount) {
156-
const std::string extraMount = "data/extraData/";
156+
const auto extraMount = fs.findInParents("test/data/extraData/", fs.basePath());
157157
const std::string extraFile = "extraFile.txt";
158158

159159
EXPECT_FALSE(fs.exists(extraFile));

0 commit comments

Comments
 (0)