This commit is contained in:
Robert Jelic
2025-02-21 19:20:36 +01:00
parent 700c33ac4b
commit b61ede7d81
2 changed files with 27 additions and 19 deletions

View File

@@ -1,6 +1,8 @@
local elementManager = require("elementManager") local elementManager = require("elementManager")
local VisualElement = elementManager.getElement("VisualElement") local VisualElement = elementManager.getElement("VisualElement")
local getCenteredPosition = require("libraries/utils").getCenteredPosition local getCenteredPosition = require("libraries/utils").getCenteredPosition
---@cofnigDescription This is a button. It is a visual element that can be clicked.
---@configDefault true
--- This is the button class. It is a visual element that can be clicked. --- This is the button class. It is a visual element that can be clicked.
---@class Button : VisualElement ---@class Button : VisualElement

View File

@@ -63,42 +63,48 @@ local function parseFile(filePath)
end end
local function categorizeFile(path) local function categorizeFile(path)
if path:match("^elements/") then -- Relativen Pfad verwenden
if path:match("/elements/") then
return "elements", "UI Elements" return "elements", "UI Elements"
elseif path:match("^plugins/") then elseif path:match("/plugins/") then
return "plugins", "Plugins" return "plugins", "Plugins"
elseif path:match("^libraries/") then elseif path:match("/libraries/") then
return "libraries", "Libraries" return "libraries", "Libraries"
else elseif path:match("^src/[^/]+%.lua$") then
return "core", "Core Files" return "core", "Core Files"
end end
return "other", "Other Files"
end end
local function scanDirectory(baseDir) local function scanDirectory(srcPath)
local files = {} local files = {}
-- Liste aller zu scannenden Ordner local basePath = srcPath:match("^(.+)/$") or srcPath
local dirs = {
baseDir .. "/elements", -- Rekursive Funktion zum Scannen von Ordnern
baseDir .. "/plugins", local function scanRecursive(dir)
baseDir .. "/libraries", local pipe = io.popen('dir "' .. dir .. '" /b')
baseDir -- für Core-Files if not pipe then return end
}
for entry in pipe:lines() do
for _, dir in ipairs(dirs) do local fullPath = dir .. "\\" .. entry
for entry in io.popen('ls -1 "' .. dir .. '"'):lines() do
if entry:match("%.lua$") then if entry:match("%.lua$") then
local fullPath = dir .. "/" .. entry
local config = parseFile(fullPath) local config = parseFile(fullPath)
if config then if config then
config.name = entry:gsub("%.lua$", "") config.name = entry:gsub("%.lua$", "")
-- Relativen Pfad erstellen -- Relativen Pfad mit Forward Slashes erstellen
config.path = fullPath:gsub("^" .. baseDir .. "/", "") config.path = fullPath:gsub("^" .. basePath .. "\\", ""):gsub("\\", "/")
files[fullPath] = config files[fullPath] = config
end end
elseif io.popen('dir "' .. fullPath .. '" /ad'):read("*l") then
-- Rekursiv in Unterordner gehen
scanRecursive(fullPath)
end end
end end
pipe:close()
end end
scanRecursive(basePath)
return files return files
end end