diff --git a/desktop_version/CONTRIBUTORS.txt b/desktop_version/CONTRIBUTORS.txt index 70731e7e..c1d6c966 100644 --- a/desktop_version/CONTRIBUTORS.txt +++ b/desktop_version/CONTRIBUTORS.txt @@ -3,6 +3,7 @@ Contributors (Ordered alphabetically by last name.) +* Matt "Stelpjo" Aaldenberg * Christoph Böhmwalder (@chrboe) * Charlie Bruce (@charliebruce) * Brian Callahan (@ibara) @@ -10,6 +11,7 @@ Contributors * Allison Fleischer (AllisonFleischer) * Daniel Lee (@ddm999) * Fredrik Ljungdahl (@FredrIQ) +* Matt Penny (@mwpenny) * Elliott Saltar (@eboyblue3) * Marvin Scholz (@ePirat) * Keith Stellyes (@keithstellyes) @@ -22,4 +24,3 @@ Contributors * Rémi Verschelde (@akien-mga) * viri (viri.me) * Wouter (Xesxen) -* Matt "Stelpjo" Aaldenberg diff --git a/desktop_version/src/FileSystemUtils.cpp b/desktop_version/src/FileSystemUtils.cpp index 9ab1e5c8..3ad39abf 100644 --- a/desktop_version/src/FileSystemUtils.cpp +++ b/desktop_version/src/FileSystemUtils.cpp @@ -39,16 +39,30 @@ void PLATFORM_getOSDirectory(char* output); void PLATFORM_migrateSaveData(char* output); void PLATFORM_copyFile(const char *oldLocation, const char *newLocation); -int FILESYSTEM_init(char *argvZero, char *assetsPath) +int FILESYSTEM_init(char *argvZero, char* baseDir, char *assetsPath) { char output[MAX_PATH]; int mkdirResult; + const char* pathSep = PHYSFS_getDirSeparator(); PHYSFS_init(argvZero); PHYSFS_permitSymbolicLinks(1); /* Determine the OS user directory */ - PLATFORM_getOSDirectory(output); + if (baseDir && strlen(baseDir) > 0) + { + strcpy(output, baseDir); + + /* We later append to this path and assume it ends in a slash */ + if (strcmp(std::string(1, output[strlen(output) - 1]).c_str(), pathSep) != 0) + { + strcat(output, pathSep); + } + } + else + { + PLATFORM_getOSDirectory(output); + } /* Create base user directory, mount */ mkdirResult = mkdir(output, 0777); diff --git a/desktop_version/src/FileSystemUtils.h b/desktop_version/src/FileSystemUtils.h index ae0c70b9..88f2b2d4 100644 --- a/desktop_version/src/FileSystemUtils.h +++ b/desktop_version/src/FileSystemUtils.h @@ -6,7 +6,7 @@ #include "tinyxml.h" -int FILESYSTEM_init(char *argvZero, char* assetsPath); +int FILESYSTEM_init(char *argvZero, char* baseDir, char* assetsPath); void FILESYSTEM_deinit(); char *FILESYSTEM_getUserSaveDirectory(); diff --git a/desktop_version/src/Game.cpp b/desktop_version/src/Game.cpp index 3d82d159..160ae6b1 100644 --- a/desktop_version/src/Game.cpp +++ b/desktop_version/src/Game.cpp @@ -468,12 +468,15 @@ void Game::init(void) patrons.push_back("Timothy Bragan"); /* CONTRIBUTORS.txt, again listed alphabetically (according to `sort`) by last name */ + githubfriends.push_back("Matt \"Stelpjo\" Aaldenberg"); githubfriends.push_back("Christoph B{hmwalder"); githubfriends.push_back("Charlie Bruce"); githubfriends.push_back("Brian Callahan"); githubfriends.push_back("Dav999"); githubfriends.push_back("Allison Fleischer"); githubfriends.push_back("Daniel Lee"); + githubfriends.push_back("Fredrik Ljungdahl"); + githubfriends.push_back("Matt Penny"); githubfriends.push_back("Elliott Saltar"); githubfriends.push_back("Marvin Scholz"); githubfriends.push_back("Keith Stellyes"); diff --git a/desktop_version/src/main.cpp b/desktop_version/src/main.cpp index 1ba006a4..ed867518 100644 --- a/desktop_version/src/main.cpp +++ b/desktop_version/src/main.cpp @@ -51,19 +51,23 @@ int main(int argc, char *argv[]) SDL_INIT_GAMECONTROLLER ); - char* assets = NULL; + char* baseDir = NULL; + char* assetsPath = NULL; for (int i = 1; i < argc; ++i) { if (strcmp(argv[i], "-renderer") == 0) { ++i; SDL_SetHintWithPriority(SDL_HINT_RENDER_DRIVER, argv[i], SDL_HINT_OVERRIDE); + } else if (strcmp(argv[i], "-basedir") == 0) { + ++i; + baseDir = argv[i]; } else if (strcmp(argv[i], "-assets") == 0) { ++i; - assets = argv[i]; + assetsPath = argv[i]; } } - if(!FILESYSTEM_init(argv[0], assets)) + if(!FILESYSTEM_init(argv[0], baseDir, assetsPath)) { return 1; }