mirror of
https://github.com/natnat-mc/moonbuild
synced 2026-06-11 22:39:40 +02:00
fixed wildcard and normalizepath
This commit is contained in:
+5
-1
@@ -120,8 +120,12 @@ normalizepath = function(file)
|
|||||||
break
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
if #parts == 0 then
|
||||||
|
return '.'
|
||||||
|
else
|
||||||
return (absolute and '/' or '') .. concat(parts, '/')
|
return (absolute and '/' or '') .. concat(parts, '/')
|
||||||
end
|
end
|
||||||
|
end
|
||||||
local ls
|
local ls
|
||||||
ls = function(d)
|
ls = function(d)
|
||||||
local _accum_0 = { }
|
local _accum_0 = { }
|
||||||
@@ -201,7 +205,7 @@ wildcard = function(glob)
|
|||||||
local absolute = (sub(glob, 1, 1)) == '/'
|
local absolute = (sub(glob, 1, 1)) == '/'
|
||||||
for i, part in ipairs(parts) do
|
for i, part in ipairs(parts) do
|
||||||
local prevpath = (absolute and '/' or '') .. concat(parts, '/', 1, i - 1)
|
local prevpath = (absolute and '/' or '') .. concat(parts, '/', 1, i - 1)
|
||||||
local currpath = prevpath .. '/' .. part
|
local currpath = (i == 1 and '' or (prevpath .. '/')) .. part
|
||||||
if match(part, '%*%*.*%*%*') then
|
if match(part, '%*%*.*%*%*') then
|
||||||
error("Two '**' in the same path component in a wildcard")
|
error("Two '**' in the same path component in a wildcard")
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -16,6 +16,9 @@ normalizepath = (file) ->
|
|||||||
remove parts, i-1
|
remove parts, i-1
|
||||||
i -= 2
|
i -= 2
|
||||||
continue
|
continue
|
||||||
|
if #parts==0
|
||||||
|
'.'
|
||||||
|
else
|
||||||
(absolute and '/' or '') .. concat parts, '/'
|
(absolute and '/' or '') .. concat parts, '/'
|
||||||
|
|
||||||
ls = (d) ->
|
ls = (d) ->
|
||||||
@@ -54,7 +57,7 @@ wildcard = (glob) ->
|
|||||||
|
|
||||||
for i, part in ipairs parts
|
for i, part in ipairs parts
|
||||||
prevpath = (absolute and '/' or '') .. concat parts, '/', 1, i-1
|
prevpath = (absolute and '/' or '') .. concat parts, '/', 1, i-1
|
||||||
currpath = prevpath .. '/' .. part
|
currpath = (i==1 and '' or (prevpath .. '/')) .. part
|
||||||
|
|
||||||
if match part, '%*%*.*%*%*'
|
if match part, '%*%*.*%*%*'
|
||||||
error "Two '**' in the same path component in a wildcard"
|
error "Two '**' in the same path component in a wildcard"
|
||||||
|
|||||||
Reference in New Issue
Block a user