city41 / mameNeoGeoDevPlugin

MAME Neo Geo Development Plugin
GNU General Public License v3.0
9 stars 1 forks source link

Support Windows #2

Open city41 opened 2 months ago

city41 commented 2 months ago

The plugin does not work on windows since it needs to use ls to get the addon files.

city41 commented 2 months ago

It's also never been tested on MacOS, but it should work there.

MacdacMacdaxter commented 1 week ago

Here is a working function to use the plugin under windows. Replace these lines in the Init.lua ` function ngdev.getAddons() local addons = {} local pluginDir = manager.options.entries.pluginspath:value() local searchPaths = { string.format("%s\ngdev\addons\.lua", pluginDir), string.format("%s\ngdev\custom_addons\.lua", pluginDir) }

for _, path in ipairs(searchPaths) do
    -- `dir` als Alternative zu `ls` für Windows verwenden
    for addonPath in io.popen(string.format("dir /b %s", path)):lines() do
        -- Volle Dateipfade zusammensetzen
        local fullPath = path:gsub("\\%*%.lua", "\\" .. addonPath)
        local addonHydrate = assert(loadfile(fullPath))
        local success, addonOrErr = pcall(addonHydrate)

        if not success then
            print(string.format("Addon failed to hydrate: %s", addonOrErr))
        else
            table.insert(addons, addonOrErr)
        end
    end
end

return addons

end `

city41 commented 1 week ago

Nice thanks! I will see about getting this incorporated.