Пример #1
0
	virtual void archive_list(const char *path, const service_ptr_t<file> &p_reader, archive_callback &p_out, bool p_want_readers)
	{
		if (!_extract_native_path_ptr(path))
			throw exception_io_data();
		AATR *aatr = pfc::new_ptr_check_t(AATR_New());
		if (!AATR_Open(aatr, path)) {
			AATR_Delete(aatr);
			throw exception_io_data();
		}
		pfc::string8_fastalloc url;
		for (;;) {
			const char *fn = AATR_NextFile(aatr);
			if (fn == NULL)
				break;
			t_filestats stats = { filesize_invalid, filetimestamp_invalid };
			service_ptr_t<file> p_file;
			if (p_want_readers) {
				BYTE module[ASAPInfo_MAX_MODULE_LENGTH];
				int module_len = AATR_ReadCurrentFile(aatr, module, sizeof(module));
				p_file = new service_impl_t<reader_membuffer_simple>(module, module_len);
			}
			archive_impl::g_make_unpack_path(url, path, fn, "atr");
			if (!p_out.on_entry(this, url, stats, p_file))
				break;
		}
		AATR_Delete(aatr);
	}
Пример #2
0
void winLocalFileScope::open( const char * inPath, file::ptr inReader, abort_callback & aborter) {
	close();
	if (inPath != NULL) {
		if (_extract_native_path_ptr( inPath ) ) {
			pfc::string8 prefixed;
			pfc::winPrefixPath( prefixed, inPath  );
			m_path = pfc::stringcvt::string_wide_from_utf8( prefixed );
			m_isTemp = false;
			return;
		}
	}

	pfc::string8 tempPath;
	if (!uGetTempPath( tempPath )) uBugCheck();
	tempPath.add_filename( PFC_string_formatter() << pfc::print_guid( pfc::createGUID() ) << ".rar" );

	m_path = pfc::stringcvt::string_wide_from_utf8( tempPath );

	if (inReader.is_empty()) {
		if (inPath == NULL) uBugCheck();
		inReader = fileOpenReadExisting( inPath, aborter, 1.0 );
	}

	file::ptr writer = fileOpenWriteNew( PFC_string_formatter() << "file://" << tempPath, aborter, 1.0 );
	file::g_transfer_file( inReader , writer, aborter );
	m_isTemp = true;
}
Пример #3
0
bool foobar2000_io::extract_native_path_ex(const char * p_fspath, pfc::string_base & p_native) {
	if (!_extract_native_path_ptr(p_fspath)) return false;
	if (p_fspath[0] != '\\' || p_fspath[1] != '\\') {
		p_native = "\\\\?\\";
		p_native += p_fspath;
	} else {
		p_native = p_fspath;
	}
	return true;
}
Пример #4
0
bool foobar2000_io::extract_native_path(const char * p_fspath,pfc::string_base & p_native) {
	if (!_extract_native_path_ptr(p_fspath)) return false;
	p_native = p_fspath;
	return true;
}