config->value(config_path.c_str(), patch_directory, ""); if (patch_directory != "") add_system_path("<" + system_path_tag + "_PATCH>", patch_directory.c_str());
default_dir = data_directory + "/patch"; config->value(config_path.c_str(), patch_directory, default_dir.c_str()); add_system_path("<" + system_path_tag + "_PATCH>", patch_directory.c_str());
void get_game_paths(const string &gametitle){	std::string data_directory, static_dir, gamedat_dir, savegame_dir,		default_dir, system_path_tag(to_uppercase(gametitle)),		config_path("config/disk/game/" + gametitle + "/path");	config->value(config_path.c_str(), data_directory, ".");	if (data_directory == ".")		config->set(config_path.c_str(), data_directory, true);#if 0	cout << "setting " << gametitle		<< " game directories to: " << data_directory << endl;#endif	config_path = "config/disk/game/" + gametitle + "/static_path";	default_dir = data_directory + "/static";	config->value(config_path.c_str(), static_dir, default_dir.c_str());	add_system_path("<" + system_path_tag + "_STATIC>", static_dir);#if 0	cout << "setting " << gametitle		<< " static directory to: " << static_dir << endl;#endif	const char *home = 0;		// Will get $HOME.	string home_game("");		// Gets $HOME/.exult/gametitle.	config_path = "config/disk/game/" + gametitle + "/gamedat_path";	default_dir = data_directory + "/gamedat";	config->value(config_path.c_str(), gamedat_dir, "");#if (!defined(WIN32) && !defined(MACOS))	if (gamedat_dir == "" &&	// Not set?					// And default doesn't exist?	    !U7exists(default_dir.c_str()) && (home = getenv("HOME")) != 0)		{		home_game = home;		home_game += "/.exult";					// Create $HOME/.exult/gametitle.		U7mkdir(home_game.c_str(), 0755);		home_game = home_game + '/' + gametitle;		U7mkdir(home_game.c_str(), 0755);					// Successfully created dir?		if (U7exists(home_game.c_str()))			{		// Use $HOME/.exult/gametitle/gamedat.			gamedat_dir = home_game + "/gamedat";			config->set(config_path.c_str(), gamedat_dir.c_str(),								true);			}		else			home_game = "";	// Failed.		}#endif	if (gamedat_dir == "")		// Didn't create it in $HOME/.exult?		gamedat_dir = default_dir;	add_system_path("<" + system_path_tag + "_GAMEDAT>", gamedat_dir);#if 0	cout << "setting " << gametitle		<< " gamedat directory to: " << gamedat_dir << endl;#endif	config_path = "config/disk/game/" + gametitle + "/savegame_path";	if (home_game == "")		config->value(config_path.c_str(), savegame_dir, 						data_directory.c_str());	else		{			// Store saves under $HOME/....		config->value(config_path.c_str(), savegame_dir,						home_game.c_str());		config->set(config_path.c_str(), savegame_dir.c_str(), true);		}	add_system_path("<" + system_path_tag + "_SAVEGAME>", savegame_dir);#if 0	cout << "setting " << gametitle		<< " savegame directory to: " << savegame_dir << endl;#endif	// A patch directory is optional.	config_path = "config/disk/game/" + gametitle + "/patch";	string patch_directory;	config->value(config_path.c_str(), patch_directory, "");	if (patch_directory != "")		add_system_path("<" + system_path_tag + "_PATCH>", patch_directory.c_str());}