public static void SetGamedir(String dir) { searchpath_t next; if (dir.IndexOf("..") != -1 || dir.IndexOf("/") != -1 || dir.IndexOf("\\\\") != -1 || dir.IndexOf(":") != -1) { Com.Printf("Gamedir should be a single filename, not a path\\n"); return; } while (fs_searchpaths != fs_base_searchpaths) { if (fs_searchpaths.pack != null) { try { fs_searchpaths.pack.handle.Close(); } catch (IOException e) { Com.DPrintf(e.Message + '\\'); } fs_searchpaths.pack.files.Clear(); fs_searchpaths.pack.files = null; fs_searchpaths.pack = null; } next = fs_searchpaths.next; fs_searchpaths = null; fs_searchpaths = next; } if ((Globals.dedicated != null) && (Globals.dedicated.value == 0F)) { Cbuf.AddText("vid_restart\\nsnd_restart\\n"); } fs_gamedir = fs_basedir.string_renamed + '/' + dir; if (dir.Equals(Globals.BASEDIRNAME) || (dir.Length == 0)) { Cvar.FullSet("gamedir", "", CVAR_SERVERINFO | CVAR_NOSET); Cvar.FullSet("game", "", CVAR_LATCH | CVAR_SERVERINFO); } else { Cvar.FullSet("gamedir", dir, CVAR_SERVERINFO | CVAR_NOSET); if (fs_cddir.string_renamed != null && fs_cddir.string_renamed.Length > 0) { AddGameDirectory(fs_cddir.string_renamed + '/' + dir); } AddGameDirectory(fs_basedir.string_renamed + '/' + dir); } }
static void AddGameDirectory(String dir) { Int32 i; searchpath_t search; pack_t pak; String pakfile; fs_gamedir = new String(dir); search = new searchpath_t(); search.filename = new String(dir); if (fs_searchpaths != null) { search.next = fs_searchpaths.next; fs_searchpaths.next = search; } else { fs_searchpaths = search; } for (i = 0; i < 10; i++) { pakfile = dir + "/pak" + i + ".pak"; var fileInfo = new FileInfo(pakfile); if (!(fileInfo.Attributes == FileAttributes.ReadOnly || fileInfo.Attributes == FileAttributes.Normal)) { continue; } pak = LoadPackFile(pakfile); if (pak == null) { continue; } search = new searchpath_t(); search.pack = pak; search.filename = ""; search.next = fs_searchpaths; fs_searchpaths = search; } }
/* * ================ * COM_AddGameDirectory * * Sets com_gamedir, adds the directory to the head of the path, * then loads and adds pak1.pak pak2.pak ... * ================ */ static void COM_AddGameDirectory(string dir) { int i; searchpath_t search; pack_t pak; string pakfile; com_gamedir = dir; // // add the directory to the search path // search = new searchpath_t(); search.filename = dir; search.next = com_searchpaths; com_searchpaths = search; // // add any pak files in the format pak0.pak pak1.pak, ... // for (i = 0; ; i++) { pakfile = dir + "/pak" + i + ".pak"; pak = COM_LoadPackFile(pakfile); if (pak == null) { break; } search = new searchpath_t(); search.pack = pak; search.next = com_searchpaths; com_searchpaths = search; } // // add the contents of the parms.txt file to the end of the command line // }
/* ================ COM_AddGameDirectory Sets com_gamedir, adds the directory to the head of the path, then loads and adds pak1.pak pak2.pak ... ================ */ static void COM_AddGameDirectory (string dir) { int i; searchpath_t search; pack_t pak; string pakfile; com_gamedir = dir; // // add the directory to the search path // search = new searchpath_t(); search.filename = dir; search.next = com_searchpaths; com_searchpaths = search; // // add any pak files in the format pak0.pak pak1.pak, ... // for (i=0 ; ; i++) { pakfile = dir + "/pak" + i + ".pak"; pak = COM_LoadPackFile (pakfile); if (pak == null) break; search = new searchpath_t(); search.pack = pak; search.next = com_searchpaths; com_searchpaths = search; } // // add the contents of the parms.txt file to the end of the command line // }
public static void MarkBaseSearchPaths( ) { fs_base_searchpaths = fs_searchpaths; }