From 590ef86c93c47f6d06e190c58630a04446b032d6 Mon Sep 17 00:00:00 2001 From: Jonathan Coates Date: Wed, 31 May 2023 19:32:35 +0100 Subject: [PATCH] Show an error message when editing read-only files See #1222 --- .../resources/data/computercraft/lua/rom/programs/edit.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/projects/core/src/main/resources/data/computercraft/lua/rom/programs/edit.lua b/projects/core/src/main/resources/data/computercraft/lua/rom/programs/edit.lua index 9821a6d7e..05c35d956 100644 --- a/projects/core/src/main/resources/data/computercraft/lua/rom/programs/edit.lua +++ b/projects/core/src/main/resources/data/computercraft/lua/rom/programs/edit.lua @@ -111,7 +111,9 @@ local function set_status(text, ok) status_text = text end -if not bReadOnly and fs.getFreeSpace(sPath) < 1024 then +if bReadOnly then + set_status("File is read only", false) +elseif fs.getFreeSpace(sPath) < 1024 then set_status("Disk is low on space", false) else local message