Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enigma directory mapping support #901

Open
Col-E opened this issue Jan 6, 2025 · 1 comment
Open

Enigma directory mapping support #901

Col-E opened this issue Jan 6, 2025 · 1 comment

Comments

@Col-E
Copy link
Owner

Col-E commented Jan 6, 2025

Engima has the option to split mappings into a directory structure, modeling packages and each class as a file in those directories.

For instance: https://github.com/FabricMC/yarn/tree/1.20.4/mappings

We can let users pick a directory, merge all the files then use the existing engima mapping support

@zisis912
Copy link

zisis912 commented Jan 6, 2025

This simple block of code below can recursively read a directory of mappings, and merge them all into one file for the user to import.

an easy temporary solution for anyone who needs this.

const fs = require("fs")

const files = fs.readdirSync("./yarn-1.20.4/mappings", { recursive: true }, (err) => {
    if (err) throw new Error("error reading directory: " + err)
})

console.log(files)

let contentArray = []

for (const file of files) {
    if (!file.endsWith(".mapping")) continue
    const content = fs.readFileSync("./yarn-1.20.4/mappings/" + file)
    contentArray.push(content)
}

// yarn mappings already have trailing newlines for some reason
let totalContent = contentArray.join("\n")

fs.writeFileSync("yarn-mappings-full.mapping", totalContent)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants