X-Git-Url: http://git.xonotic.org/?p=xonotic%2Fdarkplaces.git;a=blobdiff_plain;f=fs.c;h=f8266c71a2a7e7e10b4ee3c21f1d533f6e657010;hp=a925ff3164743ff6ec191f04111fc17adfa7c436;hb=7c62e71683de5672379f033664504eb10d431544;hpb=775c0f6d056c37d2e23f9a96ec827023fe5e3404 diff --git a/fs.c b/fs.c index a925ff31..f8266c71 100644 --- a/fs.c +++ b/fs.c @@ -1138,11 +1138,11 @@ static qbool FS_AddPack_Fullpath(const char *pakfile, const char *shortname, qbo if(already_loaded) *already_loaded = false; - if(!strcasecmp(ext, "pk3dir")) + if(!strcasecmp(ext, "pk3dir") || !strcasecmp(ext, "dpkdir")) pak = FS_LoadPackVirtual (pakfile); else if(!strcasecmp(ext, "pak")) pak = FS_LoadPackPAK (pakfile); - else if(!strcasecmp(ext, "pk3")) + else if(!strcasecmp(ext, "pk3") || !strcasecmp(ext, "dpk")) pak = FS_LoadPackPK3 (pakfile); else if(!strcasecmp(ext, "obb")) // android apk expansion pak = FS_LoadPackPK3 (pakfile); @@ -1197,15 +1197,15 @@ static qbool FS_AddPack_Fullpath(const char *pakfile, const char *shortname, qbo if(pak->vpack) { dpsnprintf(search->filename, sizeof(search->filename), "%s/", pakfile); - // if shortname ends with "pk3dir", strip that suffix to make it just "pk3" + // if shortname ends with "pk3dir" or "dpkdir", strip that suffix to make it just "pk3" or "dpk" // same goes for the name inside the pack structure l = strlen(pak->shortname); if(l >= 7) - if(!strcasecmp(pak->shortname + l - 7, ".pk3dir")) + if(!strcasecmp(pak->shortname + l - 7, ".pk3dir") || !strcasecmp(pak->shortname + l - 7, ".dpkdir")) pak->shortname[l - 3] = 0; l = strlen(pak->filename); if(l >= 7) - if(!strcasecmp(pak->filename + l - 7, ".pk3dir")) + if(!strcasecmp(pak->filename + l - 7, ".pk3dir") || !strcasecmp(pak->filename + l - 7, ".dpkdir")) pak->filename[l - 3] = 0; } return true; @@ -1287,7 +1287,8 @@ static void FS_AddGameDirectory (const char *dir) // add any PK3 package in the directory for (i = 0;i < list.numstrings;i++) { - if (!strcasecmp(FS_FileExtension(list.strings[i]), "pk3") || !strcasecmp(FS_FileExtension(list.strings[i]), "obb") || !strcasecmp(FS_FileExtension(list.strings[i]), "pk3dir")) + if (!strcasecmp(FS_FileExtension(list.strings[i]), "pk3") || !strcasecmp(FS_FileExtension(list.strings[i]), "obb") || !strcasecmp(FS_FileExtension(list.strings[i]), "pk3dir") + || !strcasecmp(FS_FileExtension(list.strings[i]), "dpk") || !strcasecmp(FS_FileExtension(list.strings[i]), "dpkdir")) { FS_AddPack_Fullpath(list.strings[i], list.strings[i] + strlen(dir), NULL, false); } @@ -1329,6 +1330,10 @@ const char *FS_FileExtension (const char *in) { const char *separator, *backslash, *colon, *dot; + dot = strrchr(in, '.'); + if (dot == NULL) + return ""; + separator = strrchr(in, '/'); backslash = strrchr(in, '\\'); if (!separator || separator < backslash) @@ -1337,8 +1342,7 @@ const char *FS_FileExtension (const char *in) if (!separator || separator < colon) separator = colon; - dot = strrchr(in, '.'); - if (dot == NULL || (separator && (dot < separator))) + if (separator && (dot < separator)) return ""; return dot + 1; @@ -1563,7 +1567,7 @@ qbool FS_ChangeGameDirs(int numgamedirs, char gamedirs[][MAX_QPATH], qbool compl } } - Host_SaveConfig(); + Host_SaveConfig(CONFIGFILENAME); fs_numgamedirs = numgamedirs; for (i = 0;i < fs_numgamedirs;i++) @@ -1574,7 +1578,7 @@ qbool FS_ChangeGameDirs(int numgamedirs, char gamedirs[][MAX_QPATH], qbool compl if (cls.demoplayback) { - CL_Disconnect_f(cmd_local); + CL_Disconnect(); cls.demonum = 0; } @@ -2517,13 +2521,9 @@ with portable ones in-place, etc) */ void FS_SanitizePath(char *path) { - int i, size; - - for(i = 0, size = strlen(path); i < size; i++) - { - if(path[i] == '\\') - path[i] = '/'; - } + for (; *path; path++) + if (*path == '\\') + *path = '/'; } /*