Exemple #1
0
PathList findResourceDirs(const fs::path& executable) {
	fs::path mapcrafter_dir = findExecutableMapcrafterDir(executable);
	PathList resources = {
		mapcrafter_dir.parent_path() / "share" / "mapcrafter",
		mapcrafter_dir / "data",
	};
	fs::path home = findHomeDir();
	if (!home.empty())
		resources.insert(resources.begin(), home / ".mapcrafter");

	for (PathList::iterator it = resources.begin(); it != resources.end(); ) {
		if (!fs::is_directory(*it))
			resources.erase(it);
		else
			++it;
	}
	return resources;
}
Exemple #2
0
PathList findLoggingConfigFiles(const fs::path& executable) {
	fs::path mapcrafter_dir = findExecutableMapcrafterDir(findExecutablePath());
	PathList configs = {
		mapcrafter_dir.parent_path().parent_path() / "etc" / "mapcrafter" / "logging.conf",
		mapcrafter_dir / "logging.conf",
	};

	fs::path home = findHomeDir();
	if (!home.empty())
		configs.insert(configs.begin(), home / ".mapcrafter" / "logging.conf");

	for (PathList::iterator it = configs.begin(); it != configs.end(); ) {
		if (!fs::is_regular_file(*it))
			configs.erase(it);
		else
			++it;
	}
	return configs;
}