From 0230a6cc0bf7fc78fe34242300e7a93498d97dd9 Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Fri, 26 Aug 2016 11:27:13 -0700 Subject: 3256 Bugfix in filesystem creation. I'm sure there are other fake-filesystem bugs. --- 088file.mu | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to '088file.mu') diff --git a/088file.mu b/088file.mu index 19539b95..012de50a 100644 --- a/088file.mu +++ b/088file.mu @@ -117,7 +117,19 @@ def transmit-to-fake-file fs:address:filesystem, filename:address:array:characte curr-filename:address:array:character <- copy 0 data:address:array:file-mapping <- get *fs, data:offset # replace file contents if it already exists + i:number <- copy 0 len:number <- length *data + { + done?:boolean <- greater-or-equal i, len + break-if done? + tmp:file-mapping <- index *data, i + curr-filename <- get tmp, name:offset + found?:boolean <- equal filename, curr-filename + loop-unless found? + put-index *data, i, new-file-mapping + reply + } + # if file didn't already exist, make room for it new-len:number <- add len, 1 new-data:address:array:file-mapping <- new file-mapping:type, new-len put *fs, data:offset, new-data -- cgit 1.4.1-2-gfad0