Esempio n. 1
0
std::vector<str_type::string> SplitString(str_type::string str, const str_type::string& c)
{
	std::vector<str_type::string> v; // I know...
	std::size_t pos;
	while ((pos = str.find(c)) != str_type::string::npos)
	{
		v.push_back(str.substr(0, pos));
		str = str.substr(pos + c.length(), str_type::string::npos);
	}
	v.push_back(str);
	return v;
}
Esempio n. 2
0
str_type::string FindResourceDir(const int argc, gs2d::str_type::char_t* argv[])
{
	for (int t = 0; t < argc; t++)
	{
		const str_type::string argStr = (argv[t]);
		if (argStr.substr(0, 4) == GS_L("dir="))
		{
			const std::vector<str_type::string> pieces = Platform::SplitString(argStr, GS_L("="));
			if (pieces.size() >= 2)
			{
				str_type::string dir = Platform::AddLastSlash(pieces[1]);
				return Platform::FixSlashes(dir);
			}
		}
	}
	return GS_L("");
}