File Device
device-fileThe File device provides basic access to the file system (read, write, copy, move, symlink, or delete files and execute external commands).
$00 - not accessible
$01 - file
$02 - directory
=== [2][RO] size
The size of the file being processed (zero for directories). Files larger than 64KB will still show up as 64KB in size.
=== [2][RO] result
Depending on the operation, this indicates:
the number of bytes read/written (read, write, append, copy)
non-zero if the operation succeeded (move, symlink)
the return value of the executed command (execute)
=== [2][RW] length
The length of the read/write buffer in bytes.
=== [2][RW] read
The address of the area of memory where data read from the file will be read into (up to file.length bytes). If the file being accessed is a directory, its content will be listed on separate lines, in the following format:
<type> <size> <name>
e.g.
01 003B test1.txt
01 0234 test2.txt
02 0000 example
Where:
Type indicates either a file (01) or a directory (02).
Size is the size (up to 64KiB) of the file in bytes, in hexadecimal format.
Name is the name of the file.
If the operation is set to execute, if this address and length are set, stout and stderr will be captured instead of being printed.
=== [2][RW] write
The address of the area of memory containing the data to write to the file (up to file.length bytes).
=== [1][RW] operation
The operation to perform on the specified file. If an error occurs, it will be written to the system.error address, starting with 3 as high nibble.
$01 - read
$02 - write
$03 - append
$04 - delete
$05 - copy
$06 - move
$07 - symlink
$08 - execute
;file
.macro file.path $30
.macro file.type $32
.macro file.size $33
.macro file.success $35
.macro file.length $37
.macro file.read $39
.macro file.write $3B
.macro file.operation $3D
=== [2][RW] path
The address of the string corresponding to the name or path to the file or directory to access. If the operation to perform is copy, move, or symlink, the path must be comprised by the source and destination paths, separated by |.
=== [1][RO] type
The type of the file being accessed. It can be set to one of the following values: