From 0b4d06b4ffcaaa1fb3ffdac1435d80478c1fa0e5 Mon Sep 17 00:00:00 2001
From: Spoike <acceptthis@users.sourceforge.net>
Date: Fri, 30 Nov 2012 02:50:50 +0000
Subject: [PATCH] Check /usr/share/quake to see if quake is installed there.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4157 fc73d0e0-1445-4013-8a0c-d673dee63da5
---
 engine/common/fs.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/engine/common/fs.c b/engine/common/fs.c
index af3d1538b..0d4bd123f 100644
--- a/engine/common/fs.c
+++ b/engine/common/fs.c
@@ -2405,10 +2405,25 @@ qboolean Sys_FindGameData(const char *poshname, const char *gamename, char *base
 	return false;
 }
 #else
+#ifdef __linux__
+#include <sys/stat.h>
+#endif
 qboolean Sys_FindGameData(const char *poshname, const char *gamename, char *basepath, int basepathlen)
 {
 #ifdef __linux__
-	// /usr/share/quake
+	struct stat sb;
+        if (!strcmp(gamename, "q1"))
+	{
+		if (stat("/usr/share/quake/", &sb) == 0)
+		{
+			// /usr/share/quake
+			if (S_ISDIR(sb.st_mode))
+			{
+				Q_strncpyz(basepath, "/usr/share/quake/", basepathlen);
+				return true;
+			}
+		}
+	}
 #endif
 	return false;
 }