-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.lua
61 lines (50 loc) · 1.41 KB
/
main.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
-- ========= Hiii, Hellooooo :) ========= --
-- Adding paths
do
local folders = {
"class",
"components",
"lib",
}
local cfolders = {
"class",
"components",
}
for _, s in ipairs(folders) do
love.filesystem.setRequirePath((love.filesystem.getRequirePath() or "") ..
";" .. s .. "/?/init.lua" ..
";" .. s .. "/?.lua")
end
for _, s in ipairs(folders) do
love.filesystem.setCRequirePath((love.filesystem.getCRequirePath() or "") .. ";lib/?.dll")
end
end
--- Runs a function on all files[and dirs] in a folder [recursively]
---@param dir string
---@param func function
---@param recursive boolean
---@param dirfunc function
local function loadfolder(dir, func, recursive, dirfunc)
dirfunc = dirfunc or nilfunc
for _, file in pairs(love.filesystem.getDirectoryItems(dir)) do
local path = dir .. "/" .. file
local info = love.filesystem.getInfo(path)
if info.type == "file" then
func(path)
elseif info.type == "directory" then
dirfunc(path)
if recursive then
loadfolder(path, func, recursive, dirfunc)
end
end
-- Ignoring symlinks (for now)
end
end
-- Loading includes
do
loadfolder("include", dofile, true)
end
class = require("middleclass")
function love.load(...)
require("app"):run(...)
end