]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
Fix it.. nah I'm just reverting :D
authorblack <black@d7cf8633-e32d-0410-b094-e92efae38249>
Thu, 14 Feb 2008 20:57:01 +0000 (20:57 +0000)
committerblack <black@d7cf8633-e32d-0410-b094-e92efae38249>
Thu, 14 Feb 2008 20:57:01 +0000 (20:57 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@8094 d7cf8633-e32d-0410-b094-e92efae38249

filematch.c
fs.c
menu.c

index bb5a942d982312a1525d337b8e41aacd1b144cfd..2a22cb0ff3a22df6eb17920682d8e4977d4d7f3f 100644 (file)
@@ -119,13 +119,11 @@ void stringlistsort(stringlist_t *list)
 }
 
 // operating system specific code
-static void adddirentry( stringlist_t *list, const char *path, const char *name )
+static void adddirentry(stringlist_t *list, const char *name)
 {
        if (strcmp(name, ".") && strcmp(name, ".."))
        {
-               char fullpath[MAX_OSPATH];
-               dpsnprintf (fullpath, sizeof (fullpath), "%s%s", path, name);
-               stringlistappend(list, fullpath);
+               stringlistappend(list, name);
        }
 }
 #ifdef WIN32
@@ -136,14 +134,14 @@ void listdirectory(stringlist_t *list, const char *path)
        char pattern[4096], *c;
        struct _finddata_t n_file;
        long hFile;
-       strlcpy (pattern, *path ? path : "./", sizeof (pattern));
+       strlcpy (pattern, path, sizeof (pattern));
        strlcat (pattern, "*", sizeof (pattern));
        // ask for the directory listing handle
        hFile = _findfirst(pattern, &n_file);
        if(hFile == -1)
                return;
        do {
-               adddirentry(list, path, n_file.name );
+               adddirentry(list, n_file.name );
        } while (_findnext(hFile, &n_file) == 0);
        _findclose(hFile);
 
@@ -159,11 +157,11 @@ void listdirectory(stringlist_t *list, const char *path)
 {
        DIR *dir;
        struct dirent *ent;
-       dir = opendir( *path ? path : "./" );
+       dir = opendir(path);
        if (!dir)
                return;
        while ((ent = readdir(dir)))
-               adddirentry(list, path, ent->d_name);
+               adddirentry(list, ent->d_name);
        closedir(dir);
 }
 #endif
diff --git a/fs.c b/fs.c
index 648b78601376548c5d174fe3d6ebada71b0bcf63..eee8a47d0c5e7afbb0346197574410d4914eb625 100644 (file)
--- a/fs.c
+++ b/fs.c
@@ -960,6 +960,7 @@ void FS_AddGameDirectory (const char *dir)
        int i;
        stringlist_t list;
        searchpath_t *search;
+       char pakfile[MAX_OSPATH];
 
        strlcpy (fs_gamedir, dir, sizeof (fs_gamedir));
 
@@ -972,7 +973,8 @@ void FS_AddGameDirectory (const char *dir)
        {
                if (!strcasecmp(FS_FileExtension(list.strings[i]), "pak"))
                {
-                       FS_AddPack_Fullpath(list.strings[i], NULL, false);
+                       dpsnprintf (pakfile, sizeof (pakfile), "%s%s", dir, list.strings[i]);
+                       FS_AddPack_Fullpath(pakfile, NULL, false);
                }
        }
 
@@ -981,7 +983,8 @@ void FS_AddGameDirectory (const char *dir)
        {
                if (!strcasecmp(FS_FileExtension(list.strings[i]), "pk3"))
                {
-                       FS_AddPack_Fullpath(list.strings[i], NULL, false);
+                       dpsnprintf (pakfile, sizeof (pakfile), "%s%s", dir, list.strings[i]);
+                       FS_AddPack_Fullpath(pakfile, NULL, false);
                }
        }
 
@@ -2596,24 +2599,23 @@ fssearch_t *FS_Search(const char *pattern, int caseinsensitive, int quiet)
                }
                else
                {
-                       int searchpathlen = strlen( searchpath->filename );
                        // get a directory listing and look at each name
                        dpsnprintf(netpath, sizeof (netpath), "%s%s", searchpath->filename, basepath);
                        stringlistinit(&dirlist);
                        listdirectory(&dirlist, netpath);
                        for (dirlistindex = 0;dirlistindex < dirlist.numstrings;dirlistindex++)
                        {
-                               const char *direntry = dirlist.strings[dirlistindex];
-                               if (matchpattern(direntry + searchpathlen, (char *)pattern, true))
+                               dpsnprintf(temp, sizeof(temp), "%s%s", basepath, dirlist.strings[dirlistindex]);
+                               if (matchpattern(temp, (char *)pattern, true))
                                {
                                        for (resultlistindex = 0;resultlistindex < resultlist.numstrings;resultlistindex++)
-                                               if (!strcmp(resultlist.strings[resultlistindex], direntry))
+                                               if (!strcmp(resultlist.strings[resultlistindex], temp))
                                                        break;
                                        if (resultlistindex == resultlist.numstrings)
                                        {
-                                               stringlistappend(&resultlist, direntry);
+                                               stringlistappend(&resultlist, temp);
                                                if (!quiet && developer_loading.integer)
-                                                       Con_Printf("SearchDirFile: %s\n", direntry);
+                                                       Con_Printf("SearchDirFile: %s\n", temp);
                                        }
                                }
                        }
diff --git a/menu.c b/menu.c
index 5ba0fe60fe70c50de504e6afa2a0951dc5619193..afae9ad2296602c7b8f8ee8dadd70678538fae12 100644 (file)
--- a/menu.c
+++ b/menu.c
@@ -4466,19 +4466,12 @@ void ModList_RebuildList(void)
 {
        int i,j;
        stringlist_t list;
-       int basedirlength; 
 
        stringlistinit(&list);
        if (fs_basedir[0])
-       {
                listdirectory(&list, fs_basedir);
-               basedirlength = strlen( fs_basedir );
-       }
        else
-       {
                listdirectory(&list, "./");
-               basedirlength = 2;
-       }
        stringlistsort(&list);
        modlist_count = 0;
        modlist_numenabled = fs_numgamedirs;
@@ -4493,7 +4486,7 @@ void ModList_RebuildList(void)
                if (FS_CheckNastyPath (list.strings[i], true)) continue;
                if (!FS_CheckGameDir(list.strings[i])) continue;
 
-               strlcpy (modlist[modlist_count].dir, list.strings[i] + basedirlength, sizeof(modlist[modlist_count].dir));
+               strlcpy (modlist[modlist_count].dir, list.strings[i], sizeof(modlist[modlist_count].dir));
                //check currently loaded mods
                modlist[modlist_count].loaded = false;
                if (fs_numgamedirs)