|
1 | | -local searchCode = require 'plugins.ffi.searchCode' |
2 | | -local cdefRerence = require 'plugins.ffi.cdefRerence' |
3 | 1 | local cdriver = require 'plugins.ffi.c-parser.cdriver' |
4 | 2 | local util = require 'plugins.ffi.c-parser.util' |
5 | 3 | local utility = require 'utility' |
6 | 4 | local SDBMHash = require 'SDBMHash' |
7 | 5 | local config = require 'config' |
8 | 6 | local fs = require 'bee.filesystem' |
9 | | -local scope = require 'workspace.scope' |
| 7 | +local ws = require 'workspace' |
| 8 | +local furi = require 'file-uri' |
10 | 9 |
|
11 | 10 | local namespace <const> = 'ffi.namespace*.' |
12 | 11 |
|
@@ -360,12 +359,15 @@ function m.build_single(codes, fileDir, uri) |
360 | 359 | if not texts then |
361 | 360 | return |
362 | 361 | end |
| 362 | + local fullPath = fileDir /ws.getRelativePath(uri) |
363 | 363 |
|
364 | | - local hash = ('%08x'):format(SDBMHash():hash(uri)) |
365 | | - local encoding = config.get(nil, 'Lua.runtime.fileEncoding') |
366 | | - local filePath = fileDir / table.concat({ hash, encoding }, '_') |
| 364 | + if fullPath:stem():string():find '%.' then |
| 365 | + local newPath = fullPath:parent_path() / (fullPath:stem():string():gsub('%.', '/') .. ".lua") |
| 366 | + fs.create_directories(newPath:parent_path()) |
| 367 | + fullPath = newPath |
| 368 | + end |
367 | 369 |
|
368 | | - utility.saveFile(tostring(filePath) .. '.d.lua', table.concat(texts, '\n')) |
| 370 | + utility.saveFile(tostring(fullPath), table.concat(texts, '\n')) |
369 | 371 | return true |
370 | 372 | end |
371 | 373 |
|
|
0 commit comments