File tree Expand file tree Collapse file tree 2 files changed +14
-11
lines changed
Expand file tree Collapse file tree 2 files changed +14
-11
lines changed Original file line number Diff line number Diff line change 1+ local uv = vim .uv or vim .loop
12local Utils = require (" eca.utils" )
23local Config = require (" eca.config" )
34
3738--- @param arch ? string
3839--- @return string
3940function M :_get_artifact_name (platform , arch )
40- platform = platform or vim . loop .os_uname ().sysname :lower ()
41- arch = arch or vim . loop .os_uname ().machine
42-
41+ platform = platform or uv .os_uname ().sysname :lower ()
42+ arch = arch or uv .os_uname ().machine
43+
4344 -- Normalize platform names
4445 if platform :match (" darwin" ) then
4546 platform = " darwin"
6566function M :_get_extension_server_path (platform , arch )
6667 local artifact_name = self :_get_artifact_name (platform , arch )
6768 local name
68-
69+
6970 if artifact_name :match (" %.jar$" ) then
7071 name = " eca.jar"
7172 else
72- platform = platform or vim . loop .os_uname ().sysname :lower ()
73+ platform = platform or uv .os_uname ().sysname :lower ()
7374 name = platform :match (" windows" ) and " eca.exe" or " eca"
7475 end
75-
76+
7677 return self ._cache_dir .. " /" .. name
7778end
7879
Original file line number Diff line number Diff line change 1+ local uv = vim .uv or vim .loop
2+
13local M = {}
24
35local CONSTANTS = {
9294--- @param path string
9395--- @return boolean
9496function M .file_exists (path )
95- local stat = vim . loop .fs_stat (path )
97+ local stat = uv .fs_stat (path )
9698 return stat and stat .type == " file"
9799end
98100
99101--- @param dir string
100102--- @return boolean
101103function M .dir_exists (dir )
102- local stat = vim . loop .fs_stat (dir )
104+ local stat = uv .fs_stat (dir )
103105 return stat and stat .type == " directory"
104106end
105107
@@ -132,12 +134,12 @@ function M.read_file(path)
132134 if not M .file_exists (path ) then
133135 return nil
134136 end
135-
137+
136138 local file = io.open (path , " r" )
137139 if not file then
138140 return nil
139141 end
140-
142+
141143 local content = file :read (" *a" )
142144 file :close ()
143145 return content
@@ -151,7 +153,7 @@ function M.write_file(path, content)
151153 if not file then
152154 return false
153155 end
154-
156+
155157 file :write (content )
156158 file :close ()
157159 return true
You can’t perform that action at this time.
0 commit comments