mzte-nv: use fernflower as java decompiler

This commit is contained in:
LordMZTE 2023-11-02 16:57:02 +01:00
parent 4ec3a2fccc
commit 17d50d10f3
Signed by: LordMZTE
GPG key ID: B64802DC33A64FF6

View file

@ -103,15 +103,15 @@ fn lGetBundleInfo(l: *c.lua_State) !c_int {
// bundles
c.lua_newtable(l);
var has_cfr = false;
var has_fernflower = false;
var iter = dir.iterate();
var idx: c_int = 1;
while (try iter.next()) |f| {
if (f.kind != .file or !std.mem.endsWith(u8, f.name, ".jar"))
continue;
if (!has_cfr and std.mem.containsAtLeast(u8, f.name, 1, "cfr"))
has_cfr = true;
if (!has_fernflower and std.mem.containsAtLeast(u8, f.name, 1, "fernflower"))
has_fernflower = true;
const path = try std.fs.path.joinZ(std.heap.c_allocator, &.{ bundle_path, f.name });
defer std.heap.c_allocator.free(path);
@ -126,8 +126,8 @@ fn lGetBundleInfo(l: *c.lua_State) !c_int {
// content_provider
c.lua_newtable(l);
if (has_cfr) {
c.lua_pushstring(l, "cfr");
if (has_fernflower) {
c.lua_pushstring(l, "fernflower");
c.lua_setfield(l, -2, "preferred");
}