// // Build a list of IWAD files // static void BuildIWADDirList(void) { char *doomwaddir; if (iwad_dirs_built) return; // Look in the current directory. Doom always does this. AddIWADDir("."); // Add DOOMWADDIR if it is in the environment doomwaddir = getenv("DOOMWADDIR"); if (doomwaddir != NULL) AddIWADDir(doomwaddir); // Add dirs from DOOMWADPATH AddDoomWadPath(); #ifdef WIN32 // Search the registry and find where IWADs have been installed. CheckUninstallStrings(); CheckCollectorsEdition(); CheckSteamEdition(); CheckDOSDefaults(); #endif // Don't run this function again. iwad_dirs_built = true; }
// Add IWAD directories parsed from splitting a path string containing // paths separated by PATH_SEPARATOR. 'suffix' is a string to concatenate // to the end of the paths before adding them. static void AddIWADPath(char *path, char *suffix) { char *left, *p; path = M_StringDuplicate(path); // Split into individual dirs within the list. left = path; for (;;) { p = strchr(left, PATH_SEPARATOR); if (p != NULL) { // Break at the separator and use the left hand side // as another iwad dir *p = '\0'; AddIWADDir(M_StringJoin(left, suffix, NULL)); left = p + 1; } else { break; } } AddIWADDir(M_StringJoin(left, suffix, NULL)); free(path); }
// // Add directories from the list in the DOOMWADPATH environment variable. // static void AddDoomWadPath(void) { char *doomwadpath = getenv("DOOMWADPATH"); char *p; if (doomwadpath == NULL) return; // Add the initial directory AddIWADDir(doomwadpath); // Split into individual dirs within the list. p = doomwadpath; for (;;) { p = strchr(p, PATH_SEPARATOR); if (p != NULL) { // Break at the separator and store the right hand side // as another iwad dir *p = '\0'; p += 1; AddIWADDir(p); } else break; } }
static void BuildIWADDirList(void) { char *doomwaddir; if (iwad_dirs_built) { return; } // Look in the current directory. Doom always does this. AddIWADDir("."); // Add DOOMWADDIR if it is in the environment doomwaddir = getenv("DOOMWADDIR"); if (doomwaddir != NULL) { AddIWADDir(doomwaddir); } // Add dirs from DOOMWADPATH AddDoomWadPath(); #ifdef _WIN32 // Search the registry and find where IWADs have been installed. CheckUninstallStrings(); CheckCollectorsEdition(); CheckSteamEdition(); CheckDOSDefaults(); // Check for GUS patches installed with the BFG edition! CheckSteamGUSPatches(); #else // Standard places where IWAD files are installed under Unix. AddIWADDir("/usr/share/games/doom"); AddIWADDir("/usr/local/share/games/doom"); // [SVE] svillarreal #if !defined(__APPLE__) if((doomwaddir = GetApplicationPath())) AddIWADDir(doomwaddir); #endif #endif // Don't run this function again. iwad_dirs_built = true; }
static void CheckInstallRootPaths(void) { unsigned int i; for (i=0; i<arrlen(root_path_keys); ++i) { char *install_path; char *subpath; unsigned int j; install_path = GetRegistryString(&root_path_keys[i]); if (install_path == NULL) { continue; } for (j=0; j<arrlen(root_path_subdirs); ++j) { subpath = M_StringJoin(install_path, DIR_SEPARATOR_S, root_path_subdirs[j], NULL); AddIWADDir(subpath); } free(install_path); } }
static void CheckUninstallStrings(void) { unsigned int i; for (i=0; i<arrlen(uninstall_values); ++i) { char *val; char *path; char *unstr; val = GetRegistryString(&uninstall_values[i]); if (val == NULL) { continue; } unstr = strstr(val, UNINSTALLER_STRING); if (unstr == NULL) { free(val); } else { path = unstr + strlen(UNINSTALLER_STRING); AddIWADDir(path); } } }
static void CheckSteamEdition(void) { char *install_path; char *subpath; size_t i; install_path = GetRegistryString(&steam_install_location); if (install_path == NULL) { return; } for (i=0; i<arrlen(steam_install_subdirs); ++i) { subpath = malloc(strlen(install_path) + strlen(steam_install_subdirs[i]) + 5); sprintf(subpath, "%s\\%s", install_path, steam_install_subdirs[i]); AddIWADDir(subpath); } free(install_path); }
static void CheckCollectorsEdition(void) { char *install_path; char *subpath; unsigned int i; install_path = GetRegistryString(&collectors_edition_value); if (install_path == NULL) { return; } for (i=0; i<arrlen(collectors_edition_subdirs); ++i) { subpath = malloc(strlen(install_path) + strlen(collectors_edition_subdirs[i]) + 5); sprintf(subpath, "%s\\%s", install_path, collectors_edition_subdirs[i]); AddIWADDir(subpath); } free(install_path); }
static void BuildIWADDirList(void) { char *env; if (iwad_dirs_built) { return; } // Look in the current directory. Doom always does this. AddIWADDir("."); // Add DOOMWADDIR if it is in the environment env = getenv("DOOMWADDIR"); if (env != NULL) { AddIWADDir(env); } // Add dirs from DOOMWADPATH: env = getenv("DOOMWADPATH"); if (env != NULL) { AddIWADPath(env, ""); } #ifdef _WIN32 // Search the registry and find where IWADs have been installed. CheckUninstallStrings(); CheckInstallRootPaths(); CheckSteamEdition(); CheckDOSDefaults(); // Check for GUS patches installed with the BFG edition! CheckSteamGUSPatches(); #else AddXdgDirs(); #endif // Don't run this function again. iwad_dirs_built = true; }
// Add standard directories where IWADs are located on Unix systems. // To respect the freedesktop.org specification we support overriding // using standard environment variables. See the XDG Base Directory // Specification: // <http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html> static void AddXdgDirs(void) { char *env, *tmp_env; // Quote: // > $XDG_DATA_HOME defines the base directory relative to which // > user specific data files should be stored. If $XDG_DATA_HOME // > is either not set or empty, a default equal to // > $HOME/.local/share should be used. env = getenv("XDG_DATA_HOME"); tmp_env = NULL; if (env == NULL) { char *homedir = getenv("HOME"); if (homedir == NULL) { homedir = "/"; } tmp_env = M_StringJoin(homedir, "/.local/share", NULL); env = tmp_env; } // We support $XDG_DATA_HOME/games/doom (which will usually be // ~/.local/share/games/doom) as a user-writeable extension to // the usual /usr/share/games/doom location. AddIWADDir(M_StringJoin(env, "/games/doom", NULL)); free(tmp_env); // Quote: // > $XDG_DATA_DIRS defines the preference-ordered set of base // > directories to search for data files in addition to the // > $XDG_DATA_HOME base directory. The directories in $XDG_DATA_DIRS // > should be seperated with a colon ':'. // > // > If $XDG_DATA_DIRS is either not set or empty, a value equal to // > /usr/local/share/:/usr/share/ should be used. env = getenv("XDG_DATA_DIRS"); if (env == NULL) { // (Trailing / omitted from paths, as it is added below) env = "/usr/local/share:/usr/share"; } // The "standard" location for IWADs on Unix that is supported by most // source ports is /usr/share/games/doom - we support this through the // XDG_DATA_DIRS mechanism, through which it can be overridden. AddIWADPath(env, "/games/doom"); // The convention set by RBDOOM-3-BFG is to install Doom 3: BFG // Edition into this directory, under which includes the Doom // Classic WADs. AddIWADPath(env, "/games/doom3bfg/base/wads"); }
// Default install directories for DOS Doom static void CheckDOSDefaults(void) { // These are the default install directories used by the deice // installer program: AddIWADDir("\\doom2"); // Doom II AddIWADDir("\\plutonia"); // Final Doom AddIWADDir("\\tnt"); AddIWADDir("\\doom_se"); // Ultimate Doom AddIWADDir("\\doom"); // Shareware / Registered Doom AddIWADDir("\\dooms"); // Shareware versions AddIWADDir("\\doomsw"); }
static void BuildIWADDirList(void) { char *doomwaddir; if (iwad_dirs_built) { return; } // Look in the current directory. Doom always does this. AddIWADDir("."); // Add DOOMWADDIR if it is in the environment doomwaddir = getenv("DOOMWADDIR"); if (doomwaddir != NULL) { AddIWADDir(doomwaddir); } // Add dirs from DOOMWADPATH AddDoomWadPath(); #if defined(_WIN32_WCE) // Windows CE locations: AddIWADDir("\\Storage Card"); AddIWADDir(getenv("HOME")); #elif defined(_WIN32) // Search the registry and find where IWADs have been installed. CheckUninstallStrings(); CheckCollectorsEdition(); CheckSteamEdition(); CheckDOSDefaults(); #else // Standard places where IWAD files are installed under Unix. AddIWADDir("/usr/share/games/doom"); AddIWADDir("/usr/local/share/games/doom"); #endif // Don't run this function again. iwad_dirs_built = true; }
// Check for Doom downloaded via Steam static void CheckSteamEdition(void) { char *install_path = GetRegistryString(&steam_install_location); char *subpath; size_t i; if (install_path == NULL) return; for (i = 0; i < arrlen(steam_install_subdirs); ++i) { subpath = M_StringJoin(install_path, DIR_SEPARATOR_S, steam_install_subdirs[i], NULL); AddIWADDir(subpath); } free(install_path); }
// Check for Doom: Collector's Edition static void CheckCollectorsEdition(void) { char *install_path; char *subpath; unsigned int i; install_path = GetRegistryString(&collectors_edition_value); if (install_path == NULL) return; for (i = 0; i < arrlen(collectors_edition_subdirs); ++i) { subpath = M_StringJoin(install_path, DIR_SEPARATOR_S, collectors_edition_subdirs[i], NULL); AddIWADDir(subpath); } free(install_path); }
static void CheckDOSDefaults(void) { // These are the default install directories used by the deice // installer program: AddIWADDir("\\doom2"); // Doom II AddIWADDir("\\plutonia"); // Final Doom AddIWADDir("\\tnt"); AddIWADDir("\\doom_se"); // Ultimate Doom AddIWADDir("\\doom"); // Shareware / Registered Doom AddIWADDir("\\dooms"); // Shareware versions AddIWADDir("\\doomsw"); AddIWADDir("\\heretic"); // Heretic AddIWADDir("\\hrtic_se"); // Heretic Shareware from Quake disc AddIWADDir("\\hexen"); // Hexen AddIWADDir("\\hexendk"); // Hexen Deathkings of the Dark Citadel AddIWADDir("\\strife"); // Strife }