diff options
| author | ruki <[email protected]> | 2018-09-29 20:57:24 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2018-09-29 20:57:24 +0800 |
| commit | e2cb95d8d86a27fc401667ddad70af7c81bcb0fc (patch) | |
| tree | 0a8bfd26e761a8401d7ae4892b13d28ffae242ce | |
| parent | 27294139797b23f90c3b46b860836f39a37d0e97 (diff) | |
modify install directory of package
| -rw-r--r-- | xmake/actions/require/package.lua | 7 | ||||
| -rw-r--r-- | xmake/core/package/package.lua | 7 |
2 files changed, 13 insertions, 1 deletions
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") |
