Revert "Add new parameter to take a directory on POSIX systems."

This reverts commit 14668939818fc97a4b773650228669c075d88c00.

Revert this commit becuase Unk wants things done a different way.
This commit is contained in:
dakriy 2019-10-20 01:41:35 -07:00
parent 1466893981
commit 7b0924d9c7
5 changed files with 3 additions and 23 deletions

View File

@ -4,7 +4,7 @@
Copyright 2014-2019 ClassiCube | Licensed under BSD-3
*/
#define GAME_MAX_CMDARGS 6
#define GAME_MAX_CMDARGS 5
#define GAME_APP_VER "1.0.8"
#define GAME_API_VER 1

View File

@ -571,12 +571,6 @@ cc_bool Launcher_StartGame(const String* user, const String* mppass, const Strin
String_AppendString(&args, user);
if (mppass->length) String_Format3(&args, " %s %s %s", mppass, ip, port);
#if defined CC_BUILD_POSIX
if (Platform_RequestedDirectory) {
String_Format1(&args, " -d%s", Platform_RequestedDirectory);
}
#endif
res = Process_StartGame(&args);
if (res) { Logger_Warn(res, "starting game"); return false; }

View File

@ -1772,13 +1772,10 @@ int Platform_GetCommandLineArgs(int argc, STRING_REF char** argv, String* args)
return count;
}
const String * Platform_RequestedDirectory = NULL;
cc_result Platform_SetDefaultCurrentDirectory(const String *requestedDirectory) {
char path[NATIVE_STR_LEN];
int i, len = 0;
cc_result res;
Platform_RequestedDirectory = requestedDirectory;
if (requestedDirectory != NULL) {
String_CopyToRaw(path, NATIVE_STR_LEN, requestedDirectory);

View File

@ -42,7 +42,6 @@ void Platform_Init(void);
void Platform_Free(void);
/* Sets the appropriate default current/working directory. */
#if defined CC_BUILD_POSIX
extern const String *Platform_RequestedDirectory;
cc_result Platform_SetDefaultCurrentDirectory(const String *requestedDirectory);
#else
cc_result Platform_SetDefaultCurrentDirectory(void);

View File

@ -164,9 +164,6 @@ int main(int argc, char** argv) {
#endif
static char ipBuffer[STRING_SIZE];
String args[GAME_MAX_CMDARGS];
#if defined CC_BUILD_POSIX
String pathString;
#endif
int argsCount;
cc_result res;
Logger_Hook();
@ -176,15 +173,8 @@ int main(int argc, char** argv) {
argsCount = Platform_GetCommandLineArgs(argc, argv, args);
#if defined CC_BUILD_POSIX
if (argsCount > 0 && args[argsCount - 1].length > 1 && args[argsCount - 1].buffer[0] == '-' && args[argsCount - 1].buffer[1] == 'd') {
pathString = String_UNSAFE_SubstringAt(&args[--argsCount], 2);
if (pathString.length > 0) {
res = Platform_SetDefaultCurrentDirectory(&pathString);
} else {
res = Platform_SetDefaultCurrentDirectory(NULL);
}
if (argsCount > 0 && args[argsCount - 1].length > 2 && args[argsCount - 1].buffer[0] == '-' && args[argsCount - 1].buffer[1] == 'd') {
res = Platform_SetDefaultCurrentDirectory(&args[--argsCount]);
} else {
res = Platform_SetDefaultCurrentDirectory(NULL);
}