From 368b614467ba99b38032d20e5b7ebbbbe822729a Mon Sep 17 00:00:00 2001 From: Pavel Skovorodko Date: Sun, 16 Jun 2024 16:36:39 +0200 Subject: [PATCH] fix(dap): dynamic library path setup fix (#425) --- CHANGELOG.md | 9 +++++++++ lua/rustaceanvim/dap.lua | 4 ++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 11f75f68..d90d14a8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,15 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [Unreleased] + +### Fixed + +- DAP: Dynamic library path setup using nigthly rust builds + (stable rustc was always used due to missed cwd parameter). +- DAP: Dynamic linking on macOS didn't work due to a typo in + `DYLD_LIBRARY_PATH` constant. + ## [4.24.1] - 2024-06-15 ### Fixed diff --git a/lua/rustaceanvim/dap.lua b/lua/rustaceanvim/dap.lua index c70641a1..33473099 100644 --- a/lua/rustaceanvim/dap.lua +++ b/lua/rustaceanvim/dap.lua @@ -188,7 +188,7 @@ local function add_dynamic_library_paths(adapter, workspace_root) if not workspace_root or environments[workspace_root] then return end - compat.system({ 'rustc', '--print', 'target-libdir' }, nil, function(sc) + compat.system({ 'rustc', '--print', 'target-libdir' }, { cwd = workspace_root }, function(sc) ---@cast sc vim.SystemCompleted local result = sc.stdout if sc.code ~= 0 or result == nil then @@ -202,7 +202,7 @@ local function add_dynamic_library_paths(adapter, workspace_root) elseif shell.is_macos() then ---@diagnostic disable-next-line: missing-parameter environments[workspace_root] = environments[workspace_root] - or format_environment_variable(adapter, 'DKLD_LIBRARY_PATH', { rustc_target_path, target_path }, ':') + or format_environment_variable(adapter, 'DYLD_LIBRARY_PATH', { rustc_target_path, target_path }, ':') else ---@diagnostic disable-next-line: missing-parameter environments[workspace_root] = environments[workspace_root]