aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Harrison <adamdharrison@gmail.com>2024-05-13 17:29:35 -0400
committerAdam Harrison <adamdharrison@gmail.com>2024-05-13 17:29:35 -0400
commit1a8998604561cd4308be8b76cdc12d6d1b0168f2 (patch)
treeaa49c66077cf656bd78bbe9b50b10658d9f022d7
parent27db72a1252adb72144e9f733eb71d76d70ae541 (diff)
downloadlite-xl-plugin-manager-1a8998604561cd4308be8b76cdc12d6d1b0168f2.tar.gz
lite-xl-plugin-manager-1a8998604561cd4308be8b76cdc12d6d1b0168f2.zip
Warn about id mismatches, but otherwise, take the basename of a path.
-rw-r--r--src/lpm.lua5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/lpm.lua b/src/lpm.lua
index 1749588..c8f1986 100644
--- a/src/lpm.lua
+++ b/src/lpm.lua
@@ -772,7 +772,10 @@ function Addon:get_install_path(bottle)
local folder = self.type == "library" and "libraries" or (self.type .. "s")
local path = (((self:is_core(bottle) or self:is_bundled()) and bottle.lite_xl.datadir_path) or (bottle.local_path and (bottle.local_path .. PATHSEP .. "user") or USERDIR)) .. PATHSEP .. folder
if self:is_asset() and self.organization == "singleton" then
- path = path .. PATHSEP .. (self.path or (self.url and common.basename(self.url) or self.id))
+ if (self.path or self.url) and common.basename(self.path or self.url):gsub("%.%w+$", "") ~= self.id then
+ log.warning(string.format("Mistmatch between asset url/path filename and id; (%s vs. %s)", self.path or self.url, self.id))
+ end
+ path = path .. PATHSEP .. (self.path and common.basename(self.path) or (self.url and common.basename(self.url) or self.id))
else
path = path .. PATHSEP .. self.id
if self.organization == "singleton" then path = path .. ".lua" end