File tree Expand file tree Collapse file tree 2 files changed +22
-18
lines changed
Expand file tree Collapse file tree 2 files changed +22
-18
lines changed Original file line number Diff line number Diff line change @@ -44,26 +44,28 @@ local cache_disabled = (function(): boolean
4444 return false
4545end )()
4646
47+ local is_windows <const> = package.config :sub (1 , 1 ) == " \\ "
48+
4749local cache_path <const> = (function (): lexical_path .Path
4850 local dir = os.getenv (" CYAN_SCRIPT_CACHE_DIR" )
4951 if dir then
5052 return (lexical_path.from_os (dir))
5153 end
52- dir = os.getenv (" XDG_CACHE_HOME" )
53- if dir then
54- return lexical_path.from_os (dir) .. " cyan-script-cache"
55- end
5654
57- if package.config :sub (1 , 1 ) == " \\ " then
58- dir = os.getenv (" AppData" )
59- return (lexical_path.from_os (dir) .. " Temp" ) .. " cyan-script-cache"
55+ dir = is_windows and os.getenv (" Temp" ) or os.getenv (" XDG_CACHE_HOME" )
56+
57+ if not dir then
58+ dir = is_windows and os.getenv (" UserProfile" ) or os.getenv (" HOME" )
59+ if dir then
60+ dir = dir .. (is_windows and " \\ _cache" or " /.cache" )
61+ end
6062 end
61- dir = os.getenv ( " HOME " )
63+
6264 if not dir then
6365 cache_disabled = true
6466 return
6567 end
66- return (lexical_path.from_os (dir) .. " .cache " ) .. " cyan-script-cache"
68+ return (lexical_path.from_os (dir) .. " cyan-script-cache" )
6769end )()
6870
6971function script .disable_cache ()
You can’t perform that action at this time.
0 commit comments