public function locate($dir, $file, $ext = '.php', $multiple = false, $cache = true)
	{
		$found = $multiple ? array() : false;

		// absolute path requested?
		if ($file[0] === '/' or substr($file,1,2) === ':\\')
		{
			if ( ! is_file($file))
			{
				// at this point, found would be either empty array or false
				return $found;
			}

			return $multiple ? array($file) : $file;
		}

		$cache_id = $multiple ? 'M.' : 'S.';
		$paths = array();

		// If a filename contains a :: then it is trying to be found in a namespace.
		// This is sometimes used to load a view from a non-loaded module.
		if ($pos = strripos($file, '::'))
		{
			// get the namespace path
			if ($path = \Autoloader::namespace_path('\\'.ucfirst(substr($file, 0, $pos))))
			{
				$cache_id .= substr($file, 0, $pos);

				// and strip the classes directory as we need the module root
				$paths = array(substr($path, 0, -8));

				// strip the namespace from the filename
				$file = substr($file, $pos + 2);
			}
		}
		else
		{
			$paths = $this->paths;

			// get extra information of the active request
			if (class_exists('Request', false) and ($request = \Request::active()))
			{
				$request->module and $cache_id .= $request->module;
				$paths = array_merge($request->get_paths(), $paths);
			}
		}

		// Merge in the flash paths then reset the flash paths
		$paths = array_merge($this->flash_paths, $paths);
		$this->clear_flash();

		$file = $this->prep_path($dir).$file.$ext;
		$cache_id .= $file;

		if ($cache and $cached_path = $this->from_cache($cache_id))
		{
			return $cached_path;
		}

		foreach ($paths as $dir)
		{
			$file_path = $dir.$file;

			if (is_file($file_path))
			{
				if ( ! $multiple)
				{
					$found = $file_path;
					break;
				}

				$found[] = $file_path;
			}
		}

		if ( ! empty($found) and $cache)
		{
			$this->add_to_cache($cache_id, $found);
		}

		return $found;
	}