mirror of
https://github.com/mistricky/codesnap.nvim.git
synced 2025-01-14 21:07:29 -08:00
25 lines
536 B
Lua
25 lines
536 B
Lua
|
local module = {}
|
||
|
|
||
|
local path_utils = require("codesnap.utils.path")
|
||
|
|
||
|
local OS_LIB_EXTENSION_MAP = {
|
||
|
mac = "dylib",
|
||
|
osx = "dylib",
|
||
|
windows = "dll",
|
||
|
linux = "so",
|
||
|
}
|
||
|
|
||
|
local RUST_BUILD_DIR = path_utils.with_dir_name("../../../generator/target/debug")
|
||
|
|
||
|
function module.get_lib_extension()
|
||
|
local extension = OS_LIB_EXTENSION_MAP[jit.os:lower()]
|
||
|
|
||
|
return extension or "so"
|
||
|
end
|
||
|
|
||
|
function module.generator_file(filename)
|
||
|
return path_utils.join("/", RUST_BUILD_DIR, filename .. "." .. module.get_lib_extension())
|
||
|
end
|
||
|
|
||
|
return module
|