Skip to content
This repository has been archived by the owner on May 16, 2020. It is now read-only.

Commit

Permalink
pass over the original etl commandline arguments to the updater, refs #…
Browse files Browse the repository at this point in the history
  • Loading branch information
jackeri committed Dec 12, 2014
1 parent cd65cd5 commit f98b5ba
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/client/cl_update.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,15 @@

#ifdef _WIN32
#define UPDATE_BINARY "updater.exe"
#define UPDATE_CMD "\"%s\" --install-dir \"%s\" --package-dir \"%s\" --script \"%s\" --wait \"%s\" --auto-close --execute etl.exe"
#define UPDATE_CMD "\"%s\" --install-dir \"%s\" --package-dir \"%s\" --script \"%s\" --wait \"%s\" --auto-close --execute \"etl.exe %s\""
#else
#define UPDATE_BINARY "updater"
#define UPDATE_CMD "'%s' --install-dir '%s' --package-dir '%s' --script '%s' --wait '%s' --auto-close --execute etl"
#define UPDATE_CMD "'%s' --install-dir '%s' --package-dir '%s' --script '%s' --wait '%s' --auto-close --execute 'etl %s'"
#endif
#define UPDATE_PACKAGE "updater.zip"
#define UPDATE_CONFIG "updater.xml"
#define UPDATE_SERVER_DLFILE "?sys=" CPUSTRING "&ver=" ETLEGACY_VERSION_SHORT "&file="
#define UPDATE_SERVER_DLFILE UPDATE_SERVER_NAME "?sys=" CPUSTRING "&ver=" ETLEGACY_VERSION_SHORT "&file=%s"
#define MIN_PACK_LEN 4

autoupdate_t autoupdate;

Expand Down Expand Up @@ -182,7 +183,7 @@ static void CL_RunUpdateBinary(const char *updateBinary, const char *updateConfi
CL_ClearStaticDownload();
}

Sys_StartProcess(va(UPDATE_CMD, fn, Cvar_VariableString("fs_basepath"), FS_BuildOSPath(Cvar_VariableString("fs_homepath"), AUTOUPDATE_DIR, NULL), FS_BuildOSPath(Cvar_VariableString("fs_homepath"), AUTOUPDATE_DIR, updateConfig), Cvar_VariableString("com_pid")), qtrue);
Sys_StartProcess(va(UPDATE_CMD, fn, Cvar_VariableString("fs_basepath"), FS_BuildOSPath(Cvar_VariableString("fs_homepath"), AUTOUPDATE_DIR, NULL), FS_BuildOSPath(Cvar_VariableString("fs_homepath"), AUTOUPDATE_DIR, updateConfig), Cvar_VariableString("com_pid"), Com_GetCommandLine()), qtrue);

// reinitialize the filesystem if the game directory or checksum has changed
// - after Legacy mod update
Expand Down Expand Up @@ -222,7 +223,7 @@ qboolean CL_CheckUpdateDownloads(void)
// Auto-update
if (autoupdate.updateStarted)
{
if (strlen(com_updatefiles->string) > 4)
if (strlen(com_updatefiles->string) > MIN_PACK_LEN)
{
CL_InitDownloads();
return qtrue;
Expand Down Expand Up @@ -252,7 +253,7 @@ qboolean CL_InitUpdateDownloads(void)
#ifdef FEATURE_AUTOUPDATE
if (autoupdate.updateStarted && NET_CompareAdr(autoupdate.autoupdateServer, clc.serverAddress))
{
if (strlen(com_updatefiles->string) > 4)
if (strlen(com_updatefiles->string) > MIN_PACK_LEN)
{
char *updateFile;
char updateFilesRemaining[MAX_TOKEN_CHARS] = "";
Expand Down Expand Up @@ -296,7 +297,7 @@ qboolean CL_InitUpdateDownloads(void)
Q_strcat(updateFilesRemaining, sizeof(updateFilesRemaining), va("%s;", updateFile));
}

if (strlen(updateFilesRemaining) > 4)
if (strlen(updateFilesRemaining) > MIN_PACK_LEN)
{
Cvar_Set("com_updatefiles", updateFilesRemaining);
}
Expand Down
27 changes: 27 additions & 0 deletions src/qcommon/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -479,6 +479,33 @@ void Com_ParseCommandLine(char *commandLine)
}
}

char *Com_GetCommandLine(void)
{
static char commandLine[1024];
char *offset;
int i = 0, len = 0, charoffset = 0;
commandLine[0] = '\0';
offset = commandLine;
for (; i < com_numConsoleLines; i++)
{
if (!com_consoleLines[i])
{
continue;
}

len = strlen(com_consoleLines[i]);
if (len)
{
Q_strncpyz(offset, va("+%s", com_consoleLines[i]), 1024 - charoffset);
len = len + 1;
charoffset += len;
offset += len;
}
}

return commandLine;
}

/**
* @brief Check for "safe" on the command line, which will skip loading of wolfconfig.cfg
*/
Expand Down
1 change: 1 addition & 0 deletions src/qcommon/qcommon.h
Original file line number Diff line number Diff line change
Expand Up @@ -1004,6 +1004,7 @@ void Com_TouchMemory(void);

// commandLine should not include the executable name (argv[0])
void Com_Init(char *commandLine);
char *Com_GetCommandLine(void);
void Com_Frame(void);
void Com_Shutdown(qboolean badProfile);

Expand Down

0 comments on commit f98b5ba

Please sign in to comment.