refuse to delete frozen definitions

This commit is contained in:
Kartik K. Agaram 2023-04-30 22:04:01 -07:00
parent 01be5ccd9d
commit bda9ceccf6
1 changed files with 4 additions and 0 deletions

View File

@ -160,6 +160,10 @@ function live.run(buf)
live.send_to_driver(json.encode(Live.filename))
elseif cmd == 'DELETE' then
local definition_name = buf:match('^%s*%S+%s+(%S+)')
if Live.frozen_definitions[definition_name] then
live.send_to_driver('ERROR definition '..definition_name..' is part of Freewheeling infrastructure and cannot be deleted.')
return
end
if Live.filename[definition_name] then
local index = table.find(Live.filenames_to_load, Live.filename[definition_name])
table.remove(Live.filenames_to_load, index)