From 15d504c160f15341adb84ad51d9d64f7690c6fc8 Mon Sep 17 00:00:00 2001 From: "wagic.the.homebrew@gmail.com" Date: Thu, 2 Dec 2010 12:56:18 +0000 Subject: [PATCH] Erwan - fix for issue 539 . It is now possible to provide several possible paths in Res.txt, the game will use the first one that matches. If none of them works, it reverts to the oldschool "Res" folder --- projects/mtg/bin/Res.txt | 6 ++++++ projects/mtg/src/GameApp.cpp | 12 +++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) create mode 100644 projects/mtg/bin/Res.txt diff --git a/projects/mtg/bin/Res.txt b/projects/mtg/bin/Res.txt new file mode 100644 index 000000000..af6beddc8 --- /dev/null +++ b/projects/mtg/bin/Res.txt @@ -0,0 +1,6 @@ +ms0:/PSP/wagic_res/ +ms0:/wagic_res/ +../../wagic_res/ +../../../wagic_res/ +../wagic_res/ +wagic_res/ diff --git a/projects/mtg/src/GameApp.cpp b/projects/mtg/src/GameApp.cpp index 53d40055a..7bf04814d 100644 --- a/projects/mtg/src/GameApp.cpp +++ b/projects/mtg/src/GameApp.cpp @@ -94,12 +94,18 @@ void GameApp::Create() string resPath; if (mfile) { - if (std::getline(mfile, resPath)) + bool found = false; + while (!found && std::getline(mfile, resPath)) { if (resPath[resPath.size() - 1] == '\r') resPath.erase(resPath.size() - 1); //Handle DOS files - //TODO ERROR Handling if file does not exist - JFileSystem::GetInstance()->SetResourceRoot(trim(resPath)); + string testfile = resPath; + testfile.append("graphics/simon.dat"); + if (fileExists(testfile.c_str())) + { + JFileSystem::GetInstance()->SetResourceRoot(trim(resPath)); + found = true; + } } mfile.close(); }