diff options
author | fesily <fesil@foxmail.com> | 2023-06-01 10:45:16 +0800 |
---|---|---|
committer | fesily <fesil@foxmail.com> | 2023-06-01 10:45:16 +0800 |
commit | 7e56bc0fab89dc34f009a18f066a08e23f6e4838 (patch) | |
tree | 625f775d5e6c3da1b1758b059374b9b21ecb5f7c /script/plugins/ffi/init.lua | |
parent | 19bf34c10f2760c8284fb4ce3160ccbb4593ec92 (diff) | |
download | lua-language-server-7e56bc0fab89dc34f009a18f066a08e23f6e4838.zip |
ffi:fix build path
Diffstat (limited to 'script/plugins/ffi/init.lua')
-rw-r--r-- | script/plugins/ffi/init.lua | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/script/plugins/ffi/init.lua b/script/plugins/ffi/init.lua index f835d73f..17159ff2 100644 --- a/script/plugins/ffi/init.lua +++ b/script/plugins/ffi/init.lua @@ -1,12 +1,11 @@ -local searchCode = require 'plugins.ffi.searchCode' -local cdefRerence = require 'plugins.ffi.cdefRerence' local cdriver = require 'plugins.ffi.c-parser.cdriver' local util = require 'plugins.ffi.c-parser.util' local utility = require 'utility' local SDBMHash = require 'SDBMHash' local config = require 'config' local fs = require 'bee.filesystem' -local scope = require 'workspace.scope' +local ws = require 'workspace' +local furi = require 'file-uri' local namespace <const> = 'ffi.namespace*.' @@ -360,12 +359,15 @@ function m.build_single(codes, fileDir, uri) if not texts then return end + local fullPath = fileDir /ws.getRelativePath(uri) - local hash = ('%08x'):format(SDBMHash():hash(uri)) - local encoding = config.get(nil, 'Lua.runtime.fileEncoding') - local filePath = fileDir / table.concat({ hash, encoding }, '_') + if fullPath:stem():string():find '%.' then + local newPath = fullPath:parent_path() / (fullPath:stem():string():gsub('%.', '/') .. ".lua") + fs.create_directories(newPath:parent_path()) + fullPath = newPath + end - utility.saveFile(tostring(filePath) .. '.d.lua', table.concat(texts, '\n')) + utility.saveFile(tostring(fullPath), table.concat(texts, '\n')) return true end |