commit b2adb7210eb83d2dc8df63a675ac7303084d85a4
parent 6266742c8ae47e60b924597181370849f624979a
Author: Virgil Dupras <hsoft@hardcoded.net>
Date: Sat, 21 Jan 2023 13:43:40 -0500
sys/file: truncate dst on Path :copyfile
Diffstat:
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/fs/sys/file.fs b/fs/sys/file.fs
@@ -86,9 +86,8 @@ struct[ Path
: :chdir ( self -- )
dup id _curpath CELLSZ + ! fs _curpath ! ;
: :fload ( self -- ) dup fs swap id fload ;
- \ TODO implement truncating for when dstfile is larger than self.
: _copyfile ( dst src -- ) \ arguments are opened File
- 2dup IO :spit File :close File :close ;
+ 2dup IO :spit over File :truncate File :close File :close ;
: :copyfile ( dst self -- ) \ arguments are paths
:open >r :open r> _copyfile ;
: :appendfile ( src self -- )