void archive_impl::open(service_ptr_t<file> & p_out,const char * path,t_open_mode mode, abort_callback & p_abort) { if (mode != open_mode_read) throw exception_io_denied(); pfc::string8 archive,file; if (!g_parse_unpack_path(path,archive,file)) throw exception_io_not_found(); open_archive(p_out,archive,file,p_abort); }
virtual void open_archive(service_ptr_t<file> &p_out, const char *archive, const char *file, abort_callback &p_abort) { BYTE module[ASAPInfo_MAX_MODULE_LENGTH]; int module_len = AATR_ReadFile(archive, file, module, sizeof(module)); if (module_len < 0) throw exception_io_not_found(); p_out = new service_impl_t<reader_membuffer_simple>(module, module_len); }
virtual t_filestats get_stats_in_archive(const char *p_archive, const char *p_file, abort_callback &p_abort) { int module_len = AATR_ReadFile(p_archive, p_file, NULL, ASAPInfo_MAX_MODULE_LENGTH); if (module_len < 0) throw exception_io_not_found(); t_filestats stats = { module_len, filetimestamp_invalid }; return stats; }
void archive_impl::get_stats(const char * p_path,t_filestats & p_stats,bool & p_is_writeable,abort_callback & p_abort) { pfc::string8 archive,file; if (g_parse_unpack_path(p_path,archive,file)) { if (g_is_remote(archive)) throw exception_io_object_is_remote(); p_is_writeable = false; p_stats = get_stats_in_archive(archive,file,p_abort); } else throw exception_io_not_found(); }
PFC_NORETURN void foobar2000_io::exception_io_from_win32(DWORD p_code) { //pfc::string_fixed_t<32> debugMsg; debugMsg << "Win32 I/O error #" << (t_uint32)p_code; //TRACK_CALL_TEXT(debugMsg); switch(p_code) { case ERROR_ALREADY_EXISTS: case ERROR_FILE_EXISTS: throw exception_io_already_exists(); case ERROR_NETWORK_ACCESS_DENIED: case ERROR_ACCESS_DENIED: throw exception_io_denied(); case ERROR_WRITE_PROTECT: throw exception_io_write_protected(); case ERROR_BUSY: case ERROR_PATH_BUSY: case ERROR_SHARING_VIOLATION: case ERROR_LOCK_VIOLATION: throw exception_io_sharing_violation(); case ERROR_HANDLE_DISK_FULL: case ERROR_DISK_FULL: throw exception_io_device_full(); case ERROR_FILE_NOT_FOUND: case ERROR_PATH_NOT_FOUND: throw exception_io_not_found(); case ERROR_BROKEN_PIPE: case ERROR_NO_DATA: throw exception_io_no_data(); case ERROR_NETWORK_UNREACHABLE: case ERROR_NETNAME_DELETED: throw exception_io_network_not_reachable(); case ERROR_NOT_READY: throw exception_io_device_not_ready(); case ERROR_INVALID_DRIVE: throw exception_io_invalid_drive(); case ERROR_CRC: case ERROR_FILE_CORRUPT: case ERROR_DISK_CORRUPT: throw exception_io_file_corrupted(); case ERROR_BUFFER_OVERFLOW: throw exception_io_buffer_overflow(); case ERROR_DISK_CHANGE: throw exception_io_disk_change(); case ERROR_DIR_NOT_EMPTY: throw exception_io_directory_not_empty(); case ERROR_INVALID_NAME: throw exception_io_invalid_path_syntax(); default: throw exception_io_win32_ex(p_code); } }
void archive_impl::list_directory(const char * p_path,directory_callback & p_out,abort_callback & p_abort) { throw exception_io_not_found(); }
bool archive_impl::is_remote(const char * src) { pfc::string8 archive,file; if (g_parse_unpack_path(src,archive,file)) return g_is_remote(archive); else throw exception_io_not_found(); }