source-modified? ( path -- ? )


Vocabulary
vocabs.refresh

Inputs and outputs
patha pathname string
?a boolean


Word description
Tests if the source file has been modified since it was last loaded. This compares the file's CRC32 checksum of the file's contents against the previously-recorded value.

Definition
USING: accessors assocs checksums checksums.crc32
io.encodings.utf8 io.files kernel namespaces source-files ;

IN: vocabs.refresh

: source-modified? ( path -- ? )
dup source-files get at [
dup path>> dup exists? [
utf8 file-lines crc32 checksum-lines
swap checksum>> = not
] [ 2drop f ] if
] [ exists? ] ?if ;