diff options
| author | ruki <[email protected]> | 2022-03-13 16:12:32 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2022-03-13 16:12:32 +0800 |
| commit | 321b13a3b93168eb840d3cb395300b5e43288307 (patch) | |
| tree | 96efc0b72ea0f3e9c34d5cced5c2bdd6c47fbd24 | |
| parent | 83dcca03f88b323d1dd47ba6c2749975c45222e7 (diff) | |
fix fetch repodir
| -rw-r--r-- | xmake/modules/private/action/require/impl/repository.lua | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/xmake/modules/private/action/require/impl/repository.lua b/xmake/modules/private/action/require/impl/repository.lua index 189fad594..6fb4fccdc 100644 --- a/xmake/modules/private/action/require/impl/repository.lua +++ b/xmake/modules/private/action/require/impl/repository.lua @@ -116,8 +116,14 @@ function pulled() if global.get("network") ~= "private" then for _, repo in ipairs(repositories()) do -- repository not found? or xmake has been re-installed - local updatefile = path.join(repo:directory(), "updated") - if not os.isdir(repo:directory()) or (os.isfile(updatefile) and os.mtime(os.programfile()) > os.mtime(updatefile)) then + local repodir = repo:directory() + local updatefile = path.join(repodir, "updated") + if not os.isfile(updatefile) or (os.isfile(updatefile) and os.mtime(os.programfile()) > os.mtime(updatefile)) then + -- fix broken empty directory + -- @see https://github.com/xmake-io/xmake/issues/2159 + if os.isdir(repodir) and os.emptydir(repodir) then + os.tryrm(repodir) + end return false end end |
