Exemple #1
0
	bool equal(boost::filesystem::path const& lhs, boost::filesystem::path const& rhs)
	{
		boost::filesystem::path lpath(lhs);
		boost::filesystem::path rpath(rhs);
		const boost::filesystem::path::value_type* l(lpath.normalize().c_str());
		const boost::filesystem::path::value_type* r(rpath.normalize().c_str());
		while ((tolower(*l) == tolower(*r) || (*l == L'\\' && *r == L'/') || (*l == L'/' && *r == L'\\')) && *l) 
		{ 
			++l; ++r; 
		}
		return *l == *r;
	}
Exemple #2
0
//request from emulation core to load non-volatile media file
void Utility::loadRequest(unsigned id, const string &path) {
  string pathname = {pathRequest(system().group(id)), path};
  
  // First try loading from a folder as normal.
  if(file::exists(pathname)) {
    mmapstream stream(pathname);
    return system().load(id, stream);
  }
  // Otherwise, if system folder, look for a resource.
  if(system().group(id) == 0) {
    lstring lpath = this->path(system().group(id)).split("/");
    pathname = {lpath(lpath.size() - 2),"/", path};
    
    if(auto contents = program->getUserResource(pathname)) {
      vectorstream stream(contents());
      return system().load(id, stream);
    }
  }
}