From: divverent Date: Sun, 22 Mar 2009 19:31:07 +0000 (+0000) Subject: curl: delete the downloaded pk3 if adding it failed X-Git-Tag: xonotic-v0.1.0preview~1787 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=1e567a7423084174478da3dca53b4d86251d449a;p=xonotic%2Fdarkplaces.git curl: delete the downloaded pk3 if adding it failed git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@8820 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/libcurl.c b/libcurl.c index 28b18f5f..58c01785 100644 --- a/libcurl.c +++ b/libcurl.c @@ -491,7 +491,17 @@ static void Curl_EndDownload(downloadinfo *di, CurlStatus status, CURLcode error FS_Close(di->stream); if(ok && di->ispak) + { ok = FS_AddPack(di->filename, NULL, true); + if(!ok) + { + // pack loading failed? + // this is critical + // better clear the file again... + di->stream = FS_OpenRealFile(di->filename, "wb", false); + FS_Close(di->stream); + } + } if(di->prev) di->prev->next = di->next; @@ -748,7 +758,7 @@ static qboolean Curl_Begin(const char *URL, const char *name, qboolean ispak, qb } else { - qfile_t *f = FS_OpenVirtualFile(fn, false); + qfile_t *f = FS_OpenRealFile(fn, "rb", false); if(f) { char buf[4] = {0};