mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-01-17 22:50:51 +00:00
fix the skins dowload location issue (not really to my satisfaction, but it
will do for now)
This commit is contained in:
parent
2e0ed3377c
commit
3b9e7db882
3 changed files with 21 additions and 13 deletions
|
@ -48,6 +48,7 @@ typedef struct gamedir_s {
|
|||
const char *name;
|
||||
const char *path;
|
||||
const char *gamecode;
|
||||
const char *skinpath;
|
||||
} gamedir_t;
|
||||
|
||||
extern searchpath_t *com_searchpaths;
|
||||
|
|
|
@ -164,6 +164,8 @@ qfs_get_gd_params (plitem_t *gdpl, gamedir_t *gamedir, dstring_t *path)
|
|||
}
|
||||
if (!gamedir->gamecode && (p = PL_ObjectForKey (gdpl, "GameCode")))
|
||||
gamedir->gamecode = strdup (p->data);
|
||||
if (!gamedir->skinpath && (p = PL_ObjectForKey (gdpl, "SkinPath")))
|
||||
gamedir->skinpath = strdup (p->data);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -931,6 +933,8 @@ COM_Gamedir (const char *dir)
|
|||
free ((char *)qfs_gamedir->path);
|
||||
if (qfs_gamedir->gamecode)
|
||||
free ((char *)qfs_gamedir->gamecode);
|
||||
if (qfs_gamedir->skinpath)
|
||||
free ((char *)qfs_gamedir->skinpath);
|
||||
free (qfs_gamedir);
|
||||
}
|
||||
|
||||
|
@ -952,6 +956,7 @@ COM_Gamedir (const char *dir)
|
|||
Sys_DPrintf ("%s\n", qfs_gamedir->name);
|
||||
Sys_DPrintf (" %s\n", qfs_gamedir->path);
|
||||
Sys_DPrintf (" %s\n", qfs_gamedir->gamecode);
|
||||
Sys_DPrintf (" %s\n", qfs_gamedir->skinpath);
|
||||
qfs_process_path (qfs_gamedir->path, dir);
|
||||
}
|
||||
|
||||
|
|
|
@ -488,13 +488,14 @@ CL_ParseDownload (void)
|
|||
}
|
||||
// open the file if not opened yet
|
||||
if (!cls.download) {
|
||||
//XXX QFS
|
||||
//if (strncmp (cls.downloadtempname, "skins/", 6))
|
||||
if (!qfs_gamedir->skinpath
|
||||
|| !*qfs_gamedir->skinpath
|
||||
|| strncmp (cls.downloadtempname, "skins/", 6))
|
||||
snprintf (name, sizeof (name), "%s/%s", com_gamedir,
|
||||
cls.downloadtempname);
|
||||
//else
|
||||
// snprintf (name, sizeof (name), "%s/%s/%s", fs_userpath->string,
|
||||
// fs_skinbase->string, cls.downloadtempname);
|
||||
else
|
||||
snprintf (name, sizeof (name), "%s/%s/%s", fs_userpath->string,
|
||||
qfs_gamedir->skinpath, cls.downloadtempname);
|
||||
|
||||
COM_CreatePath (name);
|
||||
|
||||
|
@ -530,18 +531,19 @@ CL_ParseDownload (void)
|
|||
|
||||
// rename the temp file to it's final name
|
||||
if (strcmp (cls.downloadtempname, cls.downloadname)) {
|
||||
//XXX QFS
|
||||
//if (strncmp (cls.downloadtempname, "skins/", 6)) {
|
||||
if (!qfs_gamedir->skinpath
|
||||
|| !*qfs_gamedir->skinpath
|
||||
|| strncmp (cls.downloadtempname, "skins/", 6)) {
|
||||
snprintf (oldn, sizeof (oldn), "%s/%s", com_gamedir,
|
||||
cls.downloadtempname);
|
||||
snprintf (newn, sizeof (newn), "%s/%s", com_gamedir,
|
||||
cls.downloadname);
|
||||
//} else {
|
||||
// snprintf (oldn, sizeof (oldn), "%s/%s/%s", fs_userpath->string,
|
||||
// fs_skinbase->string, cls.downloadtempname);
|
||||
// snprintf (newn, sizeof (newn), "%s/%s/%s", fs_userpath->string,
|
||||
// fs_skinbase->string, cls.downloadname);
|
||||
//}
|
||||
} else {
|
||||
snprintf (oldn, sizeof (oldn), "%s/%s/%s", fs_userpath->string,
|
||||
qfs_gamedir->skinpath, cls.downloadtempname);
|
||||
snprintf (newn, sizeof (newn), "%s/%s/%s", fs_userpath->string,
|
||||
qfs_gamedir->skinpath, cls.downloadname);
|
||||
}
|
||||
r = Qrename (oldn, newn);
|
||||
if (r)
|
||||
Con_Printf ("failed to rename, %s.\n", strerror (errno));
|
||||
|
|
Loading…
Reference in a new issue