diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2022-08-17 03:55:36 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2022-08-17 03:55:36 +0800 |
commit | 059442e0c9f667ab73dc3eb5a9bebaa5fc6fe0f5 (patch) | |
tree | ab990640bd38d824601f915accaa4064da33ca9e /script/brave | |
parent | e2987aaff16365b5ef6201b5d9139ea1543eeba3 (diff) | |
download | lua-language-server-059442e0c9f667ab73dc3eb5a9bebaa5fc6fe0f5.zip |
cleanup local cache
Diffstat (limited to 'script/brave')
-rw-r--r-- | script/brave/work.lua | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/script/brave/work.lua b/script/brave/work.lua index 49c90f83..90ed6f6f 100644 --- a/script/brave/work.lua +++ b/script/brave/work.lua @@ -1,9 +1,4 @@ local brave = require 'brave.brave' -local parser = require 'parser' -local fs = require 'bee.filesystem' -local furi = require 'file-uri' -local util = require 'utility' -local thread = require 'bee.thread' brave.on('loadProto', function () local jsonrpc = require 'jsonrpc' @@ -19,6 +14,7 @@ brave.on('loadProto', function () end) brave.on('timer', function (time) + local thread = require 'bee.thread' while true do thread.sleep(time) brave.push('wakeup') @@ -26,5 +22,19 @@ brave.on('timer', function (time) end) brave.on('loadFile', function (path) + local util = require 'utility' return util.loadFile(path) end) + +brave.on('removeCaches', function(path) + local fs = require 'bee.filesystem' + local fsu = require 'fs-utility' + for dir in fs.pairs(fs.path(path)) do + local lockFile = dir / '.lock' + local f = io.open(lockFile:string(), 'wb') + if f then + f:close() + fsu.fileRemove(dir) + end + end +end) |