From 5ac7034b1ac78918cfdf82f03e561c789c3f0529 Mon Sep 17 00:00:00 2001 From: Spoike Date: Tue, 12 Mar 2013 23:04:52 +0000 Subject: [PATCH] ------------------------------------------------------------------------ r4222 | acceptthis | 2013-02-21 11:35:10 +0000 (Thu, 21 Feb 2013) | 1 line Missing (linux) Sys_mkdir function and stuff ------------------------------------------------------------------------ git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4219 fc73d0e0-1445-4013-8a0c-d673dee63da5 --- engine/client/sys_plugfte.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/engine/client/sys_plugfte.c b/engine/client/sys_plugfte.c index c4d144037..69fce8893 100644 --- a/engine/client/sys_plugfte.c +++ b/engine/client/sys_plugfte.c @@ -578,6 +578,10 @@ void Sys_mkdir (char *path) CreateDirectory (path, NULL); } #else +void Sys_mkdir (char *path) +{ + mkdir (path, 0777); +} qboolean Update_GetHomeDirectory(char *homedir, int homedirsize) { qboolean result = false; @@ -620,9 +624,12 @@ void Update_Version_Updated(struct dl_download *dl) char pendingname[MAX_OSPATH]; FILE *pending; Update_GetHomeDirectory(pendingname, sizeof(pendingname)); - Q_strncatz(pendingname, DISTRIBUTION BUILDTYPE EXETYPE".tmp", sizeof(pendingname)); + Q_strncatz(pendingname, "pending" BUILDTYPE EXETYPE ".tmp", sizeof(pendingname)); fullsize = VFS_GETLEN(dl->file); Update_CreatePath(pendingname); +#ifndef _WIN32 + unlink(pendingname); +#endif pending = fopen(pendingname, "wb"); if (pending) { @@ -707,7 +714,7 @@ qboolean Plug_GetDownloadedName(char *updatedpath, int updatedpathlen) Update_GetHomeDirectory(currentpath, sizeof(currentpath)); Q_strncatz(currentpath, "cur" BUILDTYPE EXETYPE, sizeof(currentpath)); Update_GetHomeDirectory(pendingpath, sizeof(pendingpath)); - Q_strncatz(pendingpath, "pending" BUILDTYPE EXETYPE, sizeof(pendingpath)); + Q_strncatz(pendingpath, "pending" BUILDTYPE EXETYPE ".tmp", sizeof(pendingpath)); //truncated to be the same string? :s if (!strcmp(currentpath, pendingpath)) @@ -733,7 +740,7 @@ qboolean Plug_GetDownloadedName(char *updatedpath, int updatedpathlen) if (!stat(currentpath, &st)) { //there's a current file, yay. - Q_strncpyz(updatedpath, pendingpath, updatedpathlen); + Q_strncpyz(updatedpath, currentpath, updatedpathlen); } else { //no engine available to run. we'll have to download one (we only need to do it in this case because the engine itself autoupdates, @@ -1061,14 +1068,15 @@ void Plug_ExecuteCommand(struct context *ctx, char *message, ...) vsnprintf (finalmessage, sizeof(finalmessage)-1, message, va); va_end (va); -#ifdef _WIN32 + if (ctx->pipetoengine) { +#ifdef _WIN32 DWORD written = 0; WriteFile(ctx->pipetoengine, finalmessage, strlen(finalmessage), &written, NULL); - } #else - write(ctx->pipetoengine, finalmessage, strlen(finalmessage)); + write(ctx->pipetoengine, finalmessage, strlen(finalmessage)); #endif + } } qboolean Plug_CreatePluginProcess(struct context *ctx)