From e2cb95d8d86a27fc401667ddad70af7c81bcb0fc Mon Sep 17 00:00:00 2001 From: ruki Date: Sat, 29 Sep 2018 20:57:24 +0800 Subject: modify install directory of package --- xmake/actions/require/package.lua | 7 +++++++ xmake/core/package/package.lua | 7 ++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/xmake/actions/require/package.lua b/xmake/actions/require/package.lua index 1b8b943f7..4317845bf 100644 --- a/xmake/actions/require/package.lua +++ b/xmake/actions/require/package.lua @@ -529,7 +529,14 @@ function remove_packages(requires, opt) local packages = {} for _, instance in ipairs(load_packages(requires, opt)) do if os.isfile(instance:prefixfile()) then + + -- uninstall package from the prefix directory action.install.uninstall_prefix(instance) + + -- remove the install files + os.tryrm(instance:installdir()) + + -- remove ok table.insert(packages, instance) end end diff --git a/xmake/core/package/package.lua b/xmake/core/package/package.lua index 5d3ee15e0..efd2e893b 100644 --- a/xmake/core/package/package.lua +++ b/xmake/core/package/package.lua @@ -195,7 +195,7 @@ end function _instance:installdir(...) -- make the given install directory - local dir = path.join(self:cachedir(), "install", ...) + local dir = path.join(package.installdir(self:from("global"), self:debug(), self:plat(), self:arch()), self:name():sub(1, 1):lower(), self:name(), self:version_str(), ...) -- ensure the install directory if not os.isdir(dir) then @@ -614,6 +614,11 @@ function package.cachedir() return path.join(global.directory(), "cache", "packages") end +-- the install directory +function package.installdir(is_global, is_debug, plat, arch) + return path.join(is_global and global.directory() or config.directory(), "installed", plat or os.host(), arch or os.arch(), is_debug and "debug" or "release") +end + -- get the prefix directory function package.prefixdir(is_global, is_debug, plat, arch) return path.join(is_global and global.directory() or config.directory(), "prefix", plat or os.host(), arch or os.arch(), is_debug and "debug" or "release") -- cgit v1.3.1