[quakefs] Ensure fs_sharepath and fs_userpath are never empty

Other parts of quakefs treat an empty path as an error, so fs_sharepath
and fs_userpath must never be empty or they will effectively be
rejected. While the user explicitly setting them to empty strings is one
way for them to become empty, another is QFS_CompressPath compressing
'.' to an empty path, which makes it rather difficult to set up the
traditional quake directory tree (ie, operate from the current
directory).
This commit is contained in:
Bill Currie 2022-04-24 19:02:10 +09:00
parent 9f876390f0
commit 90447a5d3b
1 changed files with 4 additions and 0 deletions

View File

@ -1436,6 +1436,10 @@ static void
qfs_path_cvar (void *data, const cvar_t *cvar)
{
char *cpath = QFS_CompressPath (*(char **)data);
if (!*cpath) {
free (cpath);
cpath = strdup (".");
}
if (strcmp (cpath, *(char **)data)) {
free (*(char **)cvar->value.value);
*(char **)cvar->value.value = cpath;