コード例 #1
0
vector<IFilter*> IncludeFilterFactory::createFilter(const wstring& configPath, wstring& command, wstring& parameters)
{
	if (command == L"Include")
	{
		wstring value = parameters;
		while (value.length() > 0 && iswspace(value[0]))
			value = value.substr(1);

		wstring includePath;
		if (PathIsRelativeW(value.c_str()))
		{
			wchar_t filePath[MAX_PATH];
			configPath._Copy_s(filePath, sizeof(filePath) / sizeof(wchar_t), MAX_PATH);
			if (configPath.size() < MAX_PATH)
				filePath[configPath.size()] = L'\0';
			else
				filePath[MAX_PATH - 1] = L'\0';
			PathRemoveFileSpecW(filePath);
			PathAppendW(filePath, value.c_str());
			includePath = filePath;
		}
		else
			includePath = value;

		engine->loadConfigFile(includePath);
		command = L"";
	}

	return vector<IFilter*>();
}