Skip to content

Commit

Permalink
refactor: fallback to os-specific executable path
Browse files Browse the repository at this point in the history
  • Loading branch information
vyfor committed Dec 6, 2024
1 parent 1b520ca commit 19d2ef9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
14 changes: 10 additions & 4 deletions lua/cord/core/ipc.lua
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,24 @@ function IPC:connect(callback)
vim.schedule_wrap(function(err)
if err then
if err == 'ENOENT' then
local executable = self.config.advanced.server.executable_path
if self.config.advanced.server.executable_path then
self.executable = self.config.advanced.server.executable_path
else
self.executable = utils.os_name == 'Windows'
and 'target/release/cord.exe'
or 'target/release/cord'
end

if not utils.file_exists(executable) then
if not utils.file_exists(self.executable) then
logger.error(
'Server executable not found at \'' .. executable .. '\''
'Server executable not found at \'' .. self.executable .. '\''
)
return
end

local stdout = uv.new_pipe()
local stderr = uv.new_pipe()
uv.spawn(executable, {
uv.spawn(self.executable, {
args = {
'-p',
self.path,
Expand Down
2 changes: 1 addition & 1 deletion lua/cord/util/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ M.values = {
advanced = {
server = {
pipe_path = nil,
executable_path = 'target/release/cord.exe',
executable_path = nil,
timeout = 60000,
},
cursor_update_mode = 'on_move',
Expand Down

0 comments on commit 19d2ef9

Please sign in to comment.