How to use the pycdlib.udf.UDFFileEntry function in pycdlib

To help you get started, we’ve selected a few pycdlib examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github clalancette / pycdlib / tests / unit / test_udf.py View on Github external
def test_file_ident_parse_bad_encoding():
    tag = pycdlib.udf.UDFTag()
    tag.new(0, 0)

    entry = pycdlib.udf.UDFFileEntry()
    entry.new(0, 'dir', None, 2048)

    fi = pycdlib.udf.UDFFileIdentifierDescriptor()
    with pytest.raises(pycdlib.pycdlibexception.PyCdlibInvalidISO) as excinfo:
        fi.parse(b'\x00'*16 + b'\x01\x00\x00\x01' + b'\x00'*16 + b'\x00\x00\x00', 0, tag, entry)
    assert(str(excinfo.value) == 'Only UDF File Identifier Descriptor Encodings 8 or 16 are supported')
github clalancette / pycdlib / tests / unit / test_udf.py View on Github external
def test_file_entry_set_data_location_not_initialized():
    entry = pycdlib.udf.UDFFileEntry()
    with pytest.raises(pycdlib.pycdlibexception.PyCdlibInternalError) as excinfo:
        entry.set_data_location(0, 0)
    assert(str(excinfo.value) == 'UDF File Entry not initialized')
github clalancette / pycdlib / tests / unit / test_udf.py View on Github external
def test_file_entry_add_file_ident_desc_not_initialized():
    entry = pycdlib.udf.UDFFileEntry()
    desc = pycdlib.udf.UDFFileIdentifierDescriptor()
    desc.new(False, False, b'foo', None)
    with pytest.raises(pycdlib.pycdlibexception.PyCdlibInternalError) as excinfo:
        entry.add_file_ident_desc(desc, 2048)
    assert(str(excinfo.value) == 'UDF File Entry not initialized')
github clalancette / pycdlib / tests / unit / test_udf.py View on Github external
def test_file_ident_parse_bad_file_version():
    tag = pycdlib.udf.UDFTag()
    tag.new(0, 0)

    entry = pycdlib.udf.UDFFileEntry()
    entry.new(0, 'dir', None, 2048)

    fi = pycdlib.udf.UDFFileIdentifierDescriptor()
    with pytest.raises(pycdlib.pycdlibexception.PyCdlibInvalidISO) as excinfo:
        fi.parse(b'\x00'*16 + b'\x00\x00\x08\x00' + b'\x00'*16 + b'\x00\x00', 0, tag, entry)
    assert(str(excinfo.value) == 'File Identifier Descriptor file version number not 1')
github clalancette / pycdlib / tests / unit / test_udf.py View on Github external
def test_file_entry_set_extent_location_not_initialized():
    entry = pycdlib.udf.UDFFileEntry()
    with pytest.raises(pycdlib.pycdlibexception.PyCdlibInternalError) as excinfo:
        entry.set_extent_location(0, 0)
    assert(str(excinfo.value) == 'UDF File Entry not initialized')
github clalancette / pycdlib / tests / unit / test_udf.py View on Github external
def test_file_entry_remove_file_ident_desc_file_not_found():
    entry = pycdlib.udf.UDFFileEntry()
    entry.new(0, 'dir', None, 2048)
    desc = pycdlib.udf.UDFFileIdentifierDescriptor()
    desc.new(False, False, b'foo', None)
    entry.add_file_ident_desc(desc, 2048)
    with pytest.raises(pycdlib.pycdlibexception.PyCdlibInvalidInput) as excinfo:
        entry.remove_file_ident_desc_by_name(b'bar', 2048)
    assert(str(excinfo.value) == 'Cannot find file to remove')
github clalancette / pycdlib / tests / unit / test_udf.py View on Github external
def test_file_entry_is_dot_not_initialized():
    entry = pycdlib.udf.UDFFileEntry()
    with pytest.raises(pycdlib.pycdlibexception.PyCdlibInternalError) as excinfo:
        entry.is_dot()
    assert(str(excinfo.value) == 'UDF File Entry not initialized')
github clalancette / pycdlib / tests / unit / test_udf.py View on Github external
def test_file_entry_parse_bad_record_display_attrs():
    entry = pycdlib.udf.UDFFileEntry()
    tag = pycdlib.udf.UDFTag()
    tag.new(0, 0)
    with pytest.raises(pycdlib.pycdlibexception.PyCdlibInvalidISO) as excinfo:
        entry.parse(b'\x00'*16 + b'\x00\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' + b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' + b'\x00\x00\x01\x00\x01\x01\x00\x00\x00\x00\x00\x00' + b'\x00\x00\x01\x00\x01\x01\x00\x00\x00\x00\x00\x00' + b'\x00\x00\x01\x00\x01\x01\x00\x00\x00\x00\x00\x00' + b'\x01\x00\x00\x00' + b'\x00'*16 + b'\x00'*32 + b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00', 0, None, tag)
    assert(str(excinfo.value) == 'File Entry record display attributes is not 0')
github clalancette / pycdlib / tests / unit / test_udf.py View on Github external
def test_file_entry_remove_file_ident_desc_not_initialized():
    entry = pycdlib.udf.UDFFileEntry()
    with pytest.raises(pycdlib.pycdlibexception.PyCdlibInternalError) as excinfo:
        entry.remove_file_ident_desc_by_name(b'foo', 2048)
    assert(str(excinfo.value) == 'UDF File Entry not initialized')
github AHCoder / galaxy-integration-ps2 / pycdlib / facade.py View on Github external
def get_record(self, udf_path):
        # type: (str) -> udfmod.UDFFileEntry
        '''
        Get the directory record for a particular UDF path.

        Parameters:
         udf_path - The absolute path on the UDF filesystem to get the
                    record for.
        Returns:
         A udf.UDFFileEntry object that represents the path.
        '''
        ret = self.pycdlib_obj.get_record(udf_path=udf_path)
        if not isinstance(ret, udfmod.UDFFileEntry):
            raise pycdlibexception.PyCdlibInternalError('Invalid return type from get_record')
        return ret