1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
use BinRead;
use read_null_trimmed_utf8;
/// `DELD` chunk: remove a directory under the game install root.
///
/// When applied, the patcher calls `remove_dir` for `<game_root>/<name>`.
/// Unlike `ADIR`, only an empty directory can be deleted this way; if the
/// directory is non-empty the OS returns an error. If
/// [`crate::ApplySession::ignore_missing`] is set, a missing directory is
/// silently skipped instead of returning an error.
///
/// Like `ADIR`, `DELD` chunks are rare in modern patches.
///
/// # Wire format
///
/// ```text
/// [name_len: u32 BE] [name: name_len bytes, NUL-padded]
/// ```
///
/// Identical layout to [`crate::chunk::adir::AddDirectory`]. `name_len`
/// includes any trailing NUL padding bytes; the parsed field has them stripped.
///
/// # Errors
///
/// Parsing fails with [`crate::ParseError::Decode`] if:
/// - the body is too short to contain the `name_len` field or the declared
/// number of name bytes (truncated input), or
/// - the name bytes are not valid UTF-8.
pub