فهرست منبع

Skip hidden files

Donald Hays 4 ماه پیش
والد
کامیت
c69dfaf2d6
1فایلهای تغییر یافته به همراه15 افزوده شده و 11 حذف شده
  1. 15 11
      api/main.lua

+ 15 - 11
api/main.lua

@@ -240,17 +240,21 @@ local function processModule(path)
   end
   end
 
 
   for _, file in ipairs(lovr.filesystem.getDirectoryItems(path)) do
   for _, file in ipairs(lovr.filesystem.getDirectoryItems(path)) do
-    local childPath = path .. '/' .. file
-    local childModule = childPath:gsub('%..+$', '')
-    local isFile = lovr.filesystem.isFile(childPath)
-    local capitalized = file:match('^[A-Z]')
-
-    if file ~= 'init.lua' and not capitalized and isFile then
-      table.insert(module.functions, processFunction(childModule, module))
-    elseif capitalized and not isFile then
-      table.insert(module.objects, processObject(childModule, module))
-    elseif capitalized and isFile then
-      table.insert(module.enums, processEnum(childModule, module))
+    if file:match('^%.') then
+      warn('Skipping hidden file "%s"', file)
+    else
+      local childPath = path .. '/' .. file
+      local childModule = childPath:gsub('%..+$', '')
+      local isFile = lovr.filesystem.isFile(childPath)
+      local capitalized = file:match('^[A-Z]')
+
+      if file ~= 'init.lua' and not capitalized and isFile then
+        table.insert(module.functions, processFunction(childModule, module))
+      elseif capitalized and not isFile then
+        table.insert(module.objects, processObject(childModule, module))
+      elseif capitalized and isFile then
+        table.insert(module.enums, processEnum(childModule, module))
+      end
     end
     end
   end
   end