blob: 046a9f9af19f65032a6d9929c2b07832c02dcc66 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
local Cache = {}
local os = {
iswin32 = vim.fn.has("win32") == 1,
ismac = vim.fn.has("mac") == 1,
iswsl = vim.fn.has("wsl") == 1,
islinux = vim.fn.has("linux") == 1,
}
local dir = {
unix = vim.fn.expand("~") .. "/.cache/cmake_explorer_nvim/",
mac = vim.fn.expand("~") .. "/.cache/cmake_explorer_nvim/",
win = vim.fn.expand("~") .. "/AppData/Local/cmake_explorer_nvim/",
}
local function get_cache_path()
if os.islinux then
return dir.unix
elseif os.ismac then
return dir.mac
elseif os.iswsl then
return dir.unix
elseif os.iswin32 then
return dir.win
end
end
local function get_clean_path(path)
local current_path = path
local clean_path = current_path:gsub("/", "")
clean_path = clean_path:gsub("\\", "")
clean_path = clean_path:gsub(":", "")
return clean_path
end
function Cache.load(path)
return
end
function Cache.save_global(tbl)
local to_save = vim.tbl_deep_extend("keep", tbl)
setmetatable(to_save, nil)
local path = get_project_path()
local file = io.open(path, "w")
end
return Cache
|