Exemplo n.º 1
0
Path::Path(const Path& p1, const Path& p2)
{
	// TODO: Handle case p2.HasVolume()==true

	vector<UCS2String> f1(p1.GetAllFolders());
	vector<UCS2String> f2(p2.GetAllFolders());

	volume = p1.GetVolume();

	for(vector<UCS2String>::iterator i(f1.begin()); i != f1.end(); i++)
		folders.push_back(*i);
	for(vector<UCS2String>::iterator i(f2.begin()); i != f2.end(); i++)
		folders.push_back(*i);

	file = p2.GetFile();
}
Exemplo n.º 2
0
	/////////////////////////////////////////////////////////////////////////
	// return true if the path component of file is equal to the path component
	// of path. will also return true if recursive is true and path is a parent
	// of file. does not support relative paths, and will perform case-sensitive
	// comparisons.
	bool vfeUnixSession::TestPath (const Path& path, const Path& file, bool recursive) const
	{
		// we don't support relative paths
		if (path.HasVolume() == false || file.HasVolume() == false)
			return (false);
		if (StrCompare(path.GetVolume(), file.GetVolume()) == false)
			return (false);

		vector<UCS2String> pc = path.GetAllFolders();
		vector<UCS2String> fc = file.GetAllFolders();
		if (fc.size() < pc.size())
			return (false) ;
		for (int i = 0 ; i < pc.size(); i++)
			if (StrCompare(fc[i], pc[i]) == false)
				return (false) ;
		return (fc.size() == pc.size() ? true : recursive);
	}
Exemplo n.º 3
0
bool Path::operator==(const Path& p) const
{
	if(volume != p.GetVolume())
		return false;

	if(folders != p.GetAllFolders())
		return false;

	if(file != p.GetFile())
		return false;

	return true;
}