1
0
mirror of https://github.com/natnat-mc/moonbuild synced 2026-05-14 06:51:14 +02:00

fixed broken cache

This commit is contained in:
Nathan DECHER
2020-09-14 11:08:04 +02:00
parent cf252749f4
commit 0c43e3a5b1
3 changed files with 36 additions and 15 deletions
+3 -3
View File
@@ -12,7 +12,7 @@ makecached = (fn) ->
freeze = (val) ->
cache[val] = FROZEN
reset = ->
clear = ->
cache = {}
get = (val) ->
@@ -24,10 +24,10 @@ makecached = (fn) ->
cache[val] = ret
unpack ret
setmetatable { :get, :invalidate, :freeze, :reset },
setmetatable { :get, :invalidate, :freeze, :clear },
__call: (val) => get val
{
attributes: makecached attributes
dir: makecached dir
dir: makecached (file) -> [k for k in dir file]
}
+8 -5
View File
@@ -19,12 +19,11 @@ normalizepath = (file) ->
(absolute and '/' or '') .. concat parts, '/'
ls = (d) ->
[f for f in dir normalizepath d when f!='.' and f!='..']
[f for f in *dir normalizepath d when f!='.' and f!='..']
lswithpath = (d) ->
if d==''
return ls '.'
[d..'/'..f for f in dir normalizepath d when f!='.' and f!='..']
return ls '.' if d==''
[d..'/'..f for f in *dir normalizepath d when f!='.' and f!='..']
exists = (f) ->
(attributes normalizepath f) != nil
@@ -109,10 +108,14 @@ invalidatecache = (file) ->
dir.invalidate parentdir file
attributes.invalidate file
clearcache = ->
dir.clear!
attributes.clear!
{
:wildcard
:exists, :isdir
:mtime
:normalizepath, :parentdir
:freezecache, :invalidatecache
:freezecache, :invalidatecache, :clearcache
}