@@ -4,7 +4,10 @@ local Promise = require('orgmode.utils.promise')
44--- @class OrgState
55local OrgState = { data = {}, _ctx = { loaded = false , saved = false , curr_loader = nil , savers = 0 , dirty = false } }
66
7- local cache_path = vim .fs .normalize (vim .fn .stdpath (' cache' ) .. ' /org-cache.json' , { expand_env = false })
7+ -- local cache_path = vim.fs.normalize(vim.fn.stdpath('cache') .. '/org-cache.json', { expand_env = false })
8+ local function get_cache_path ()
9+ return vim .fs .normalize (vim .fn .stdpath (' cache' ) .. ' /org-cache.json' , { expand_env = false })
10+ end
811
912--- Returns the current OrgState singleton
1013--- @return OrgState
@@ -39,7 +42,8 @@ function OrgState:save()
3942 self :load ()
4043 self ._ctx .savers = self ._ctx .savers + 1
4144 return utils
42- .writefile (cache_path , vim .json .encode (OrgState .data ))
45+ -- .writefile(cache_path, vim.json.encode(OrgState.data))
46+ .writefile (get_cache_path (), vim .json .encode (OrgState .data ))
4347 :next (function ()
4448 self ._ctx .savers = self ._ctx .savers - 1
4549 if self ._ctx .savers == 0 then
@@ -82,7 +86,8 @@ function OrgState:load()
8286 end
8387
8488 self ._ctx .curr_loader = utils
85- .readfile (cache_path , { raw = true })
89+ -- .readfile(cache_path, { raw = true })
90+ .readfile (get_cache_path (), { raw = true })
8691 :next (function (data )
8792 local success , decoded = pcall (vim .json .decode , data , {
8893 luanil = { object = true , array = true },
0 commit comments