---
--- Date         : 2020-07-23 16:41:43
--- Author       : LICHAO7
--- LastEditors  : LICHAO7
--- LastEditTime : 2020-07-30 18:34:25
--- Description  : 
---

local FLIGHT_PATH = FS.Path.Join(FS.GetCwd(), "UGCSource/flight");
local FLIGHT_EXT  = ".mesh";

Flight = function()
    return {
        name = "",
        path = "",
    };
end

GetUserModels = function()
    local umodels = {};
    FS.Walk(FLIGHT_PATH, function(current, dirs, files)
        while true do
            local file = table.remove(files, 1);
            if file and (string.upper(FS.Path.SplitExt(file)) == string.upper(FLIGHT_EXT)) then
                local path   = FS.Path.Join(current, file);
                local flight = Flight();
                local dir    = FS.Path.Split(FS.Path.SplitDir(path));
                flight.path  = path;
                flight.name  = dir[#dir];
                table.insert(umodels, flight);
            end
            if file == nil then
                break;
            end
        end
    end);
    return umodels;
end