예제 #1
0
/// Attempts to open the stream pointing at a given URL.
bool StreamFile::Open(const String& path)
{
	String url_safe_path = path.Replace(":", "|");
	SetStreamDetails(URL(url_safe_path), Stream::MODE_READ);

	if (file_handle)
		Close();

	// Fix the path if a leading colon has been replaced with a pipe.
	String fixed_path = path.Replace("|", ":");
	file_handle = GetFileInterface()->Open(fixed_path);
	if (!file_handle)
	{
		Log::Message(Log::LT_WARNING, "Unable to open file %s.", fixed_path.CString());
		return false;
	}

	GetLength();

	return true;
}
예제 #2
0
void StreamMemory::SetSourceURL(const URL& url)
{
	SetStreamDetails(url, Stream::MODE_READ | (owns_buffer ? Stream::MODE_WRITE : 0));
}