From 6e8ef86afc5a559ff4df7f43bec53f82a9060731 Mon Sep 17 00:00:00 2001 From: Alexander Pickering Date: Wed, 3 Oct 2018 17:46:45 -0400 Subject: Allow brokengine to start projects in other directories Allow the second argument passed to brokengine on the command line specify the location of the data/ folder the program uses. --- src/client/main.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'src/client/main.cpp') diff --git a/src/client/main.cpp b/src/client/main.cpp index 63b7131..4885d8a 100644 --- a/src/client/main.cpp +++ b/src/client/main.cpp @@ -122,12 +122,19 @@ int main(int argc, char *argv[]){ //Load the lua libraries loadLLibs(state); //Defined in initdevice.cpp, creates the irrlicht device - device = spawnIrrDevice(state); + printf("Argc: %d\n",argc); + char *path; + if(argc == 2){ + path = argv[1]; + }else{ + path = (char*)"../data"; + } + device = spawnIrrDevice(state,path); if (!device){ printf("Failed to initalize device\n"); return 1; } - device->getFileSystem()->changeWorkingDirectoryTo("../data"); + device->getFileSystem()->changeWorkingDirectoryTo(path); //ILogger* log = device->getLogger(); //log->setLogLevel(ELL_NONE); //Loads libraries for interfaceing with irrlicht @@ -198,6 +205,6 @@ int main(int argc, char *argv[]){ phys_shutdown(RemoveISceneNode); device->drop(); - + printf("Goodbye\n"); return 0; } -- cgit v1.2.3-70-g09d2