]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - fs.c
disable offsetmapping where TEXF_ALPHA is not set and no height bias exists
[xonotic/darkplaces.git] / fs.c
diff --git a/fs.c b/fs.c
index ec93c091cca705081e8242d86ab9bd12c0cc0b85..4288ab5dd1c20378928cd2edd9c80b6942b68a63 100644 (file)
--- a/fs.c
+++ b/fs.c
@@ -1206,7 +1206,7 @@ void FS_AddGameDirectory (const char *dir)
 
        stringlistinit(&list);
        listdirectory(&list, "", dir);
-       stringlistsort(&list);
+       stringlistsort(&list, false);
 
        // add any PAK package in the directory
        for (i = 0;i < list.numstrings;i++)
@@ -1647,7 +1647,7 @@ static void FS_ListGameDirs(void)
        stringlistinit(&list);
        listdirectory(&list, va("%s/", fs_basedir), "");
        listdirectory(&list, va("%s/", fs_userdir), "");
-       stringlistsort(&list);
+       stringlistsort(&list, false);
 
        stringlistinit(&list2);
        for(i = 0; i < list.numstrings; ++i)
@@ -1881,19 +1881,34 @@ int FS_ChooseUserDir(userdirmode_t userdirmode, char *userdir, size_t userdirsiz
        if (userdirmode == USERDIRMODE_NOHOME && strcmp(gamedirname1, "id1"))
                return 0; // don't bother checking if the basedir folder is writable, it's annoying...  unless it is Quake on Windows where NOHOME is the default preferred and we have to check for an error case
 #endif
+
        // see if we can write to this path (note: won't create path)
-#if _MSC_VER >= 1400
+#ifdef WIN32
+# if _MSC_VER >= 1400
        _sopen_s(&fd, va("%s%s/config.cfg", userdir, gamedirname1), O_WRONLY | O_CREAT, _SH_DENYNO, _S_IREAD | _S_IWRITE); // note: no O_TRUNC here!
-#else
+# else
        fd = open (va("%s%s/config.cfg", userdir, gamedirname1), O_WRONLY | O_CREAT, 0666); // note: no O_TRUNC here!
+# endif
+       if(fd >= 0)
+               close(fd);
+#else
+       // on Unix, we don't need to ACTUALLY attempt to open the file
+       if(access(va("%s%s/", userdir, gamedirname1), W_OK | X_OK) >= 0)
+               fd = 1;
+       else
+               fd = 0;
 #endif
        if(fd >= 0)
        {
-               close(fd);
                return 1; // good choice - the path exists and is writable
        }
        else
-               return 0; // probably good - failed to write but maybe we need to create path
+       {
+               if (userdirmode == USERDIRMODE_NOHOME)
+                       return -1; // path usually already exists, we lack permissions
+               else
+                       return 0; // probably good - failed to write but maybe we need to create path
+       }
 }
 
 /*
@@ -3512,7 +3527,7 @@ fssearch_t *FS_Search(const char *pattern, int caseinsensitive, int quiet)
 
        if (resultlist.numstrings)
        {
-               stringlistsort(&resultlist);
+               stringlistsort(&resultlist, true);
                numfiles = resultlist.numstrings;
                numchars = 0;
                for (resultlistindex = 0;resultlistindex < resultlist.numstrings;resultlistindex++)
@@ -3616,7 +3631,7 @@ int FS_ListDirectory(const char *pattern, int oneperline)
 static void FS_ListDirectoryCmd (const char* cmdname, int oneperline)
 {
        const char *pattern;
-       if (Cmd_Argc() > 3)
+       if (Cmd_Argc() >= 3)
        {
                Con_Printf("usage:\n%s [path/pattern]\n", cmdname);
                return;