diff options
| author | William Boman <william@redwill.se> | 2023-10-13 00:23:23 +0200 |
|---|---|---|
| committer | William Boman <william@redwill.se> | 2025-02-19 09:23:19 +0100 |
| commit | e98f291d75e9bf519b670ad4aee93029317a86f9 (patch) | |
| tree | e6a89e6ad77414a70c3a37b7b51b9a83e10c9fd6 /lua | |
| parent | chore: hoist single file modules (diff) | |
| download | mason-e98f291d75e9bf519b670ad4aee93029317a86f9.tar mason-e98f291d75e9bf519b670ad4aee93029317a86f9.tar.gz mason-e98f291d75e9bf519b670ad4aee93029317a86f9.tar.bz2 mason-e98f291d75e9bf519b670ad4aee93029317a86f9.tar.lz mason-e98f291d75e9bf519b670ad4aee93029317a86f9.tar.xz mason-e98f291d75e9bf519b670ad4aee93029317a86f9.tar.zst mason-e98f291d75e9bf519b670ad4aee93029317a86f9.zip | |
refactor: add InstallLocation.global()
Diffstat (limited to 'lua')
| -rw-r--r-- | lua/mason-core/installer/location.lua | 5 | ||||
| -rw-r--r-- | lua/mason-core/package.lua | 2 |
2 files changed, 6 insertions, 1 deletions
diff --git a/lua/mason-core/installer/location.lua b/lua/mason-core/installer/location.lua index 2cc038e4..694ae0f4 100644 --- a/lua/mason-core/installer/location.lua +++ b/lua/mason-core/installer/location.lua @@ -1,6 +1,7 @@ local Path = require "mason-core.path" local Result = require "mason-core.result" local fs = require "mason-core.fs" +local settings = require "mason.settings" ---@class InstallLocation ---@field private dir string @@ -14,6 +15,10 @@ function InstallLocation.new(dir) }, InstallLocation) end +function InstallLocation.global() + return InstallLocation.new(settings.current.install_root_dir) +end + function InstallLocation:get_dir() return self.dir end diff --git a/lua/mason-core/package.lua b/lua/mason-core/package.lua index b0da8a61..1c9eee96 100644 --- a/lua/mason-core/package.lua +++ b/lua/mason-core/package.lua @@ -159,7 +159,7 @@ function Package:install(opts, callback) opts = opts or {} assert(not self:is_installing(), "Package is already installing.") local handle = self:new_handle() - local runner = InstallRunner.new(InstallLocation.new(settings.current.install_root_dir), handle, semaphore) + local runner = InstallRunner.new(InstallLocation.global(), handle, semaphore) runner:execute(opts, callback) return handle end |
