mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2025-01-05 23:10:30 +00:00
Better shell.programs() fix
Prevents duplicate entries
This commit is contained in:
parent
fb00698557
commit
19c8613dea
@ -171,6 +171,9 @@ function shell.programs( _bIncludeHidden )
|
|||||||
local sFile = tList[n]
|
local sFile = tList[n]
|
||||||
if not fs.isDir( fs.combine( sPath, sFile ) ) and
|
if not fs.isDir( fs.combine( sPath, sFile ) ) and
|
||||||
(_bIncludeHidden or string.sub( sFile, 1, 1 ) ~= ".") then
|
(_bIncludeHidden or string.sub( sFile, 1, 1 ) ~= ".") then
|
||||||
|
if #sFile > 4 and sFile:sub(-4) == ".lua" then
|
||||||
|
sFile = sFile:sub(1,-5)
|
||||||
|
end
|
||||||
tItems[ sFile ] = true
|
tItems[ sFile ] = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -180,11 +183,7 @@ function shell.programs( _bIncludeHidden )
|
|||||||
-- Sort and return
|
-- Sort and return
|
||||||
local tItemList = {}
|
local tItemList = {}
|
||||||
for sItem, b in pairs( tItems ) do
|
for sItem, b in pairs( tItems ) do
|
||||||
if sItem:sub(-4) == ".lua" then
|
table.insert( tItemList, sItem )
|
||||||
table.insert( tItemList, sItem:sub(1,-5) )
|
|
||||||
else
|
|
||||||
table.insert( tItemList, sItem )
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
table.sort( tItemList )
|
table.sort( tItemList )
|
||||||
return tItemList
|
return tItemList
|
||||||
|
Loading…
Reference in New Issue
Block a user