From a141f4571597a5c00f32a60629051dc6f77263c1 Mon Sep 17 00:00:00 2001 From: Spoike Date: Thu, 11 Apr 2013 10:34:06 +0000 Subject: [PATCH] Bit more verbose. Also ensures that the location actually exists. git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4311 fc73d0e0-1445-4013-8a0c-d673dee63da5 --- engine/client/sys_win.c | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/engine/client/sys_win.c b/engine/client/sys_win.c index dedcdb69b..28cd97e49 100644 --- a/engine/client/sys_win.c +++ b/engine/client/sys_win.c @@ -2152,6 +2152,21 @@ qboolean Update_GetHomeDirectory(char *homedir, int homedirsize) return false; } +static void Update_CreatePath (char *path) +{ + char *ofs; + + for (ofs = path+1 ; *ofs ; ofs++) + { + if (*ofs == '/') + { // create the directory + *ofs = 0; + Sys_mkdir (path); + *ofs = '/'; + } + } +} + #include "fs.h" void Update_Version_Updated(struct dl_download *dl) { @@ -2166,8 +2181,11 @@ void Update_Version_Updated(struct dl_download *dl) vfsfile_t *pending; Update_GetHomeDirectory(pendingname, sizeof(pendingname)); Q_strncatz(pendingname, DISTRIBUTION BUILDTYPE EXETYPE".tmp", sizeof(pendingname)); + Update_CreatePath(pendingname); pending = VFSOS_Open(pendingname, "wb"); - if (pending) + if (!pending) + Con_Printf("Unable to write to \"%s\"\n", pendingname); + else { while(1) { @@ -2226,21 +2244,6 @@ void Update_Check(void) } } -static void Update_CreatePath (char *path) -{ - char *ofs; - - for (ofs = path+1 ; *ofs ; ofs++) - { - if (*ofs == '/') - { // create the directory - *ofs = 0; - Sys_mkdir (path); - *ofs = '/'; - } - } -} - qboolean Sys_CheckUpdated(void) { int ffe = COM_CheckParm("--fromfrontend");