mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-22 16:13:12 +09:00
Replace ini packages with homebrew module
The INI format Factorio use differs from what the ini package parse and produce. Most notably no escape mechanism exists in Factorio's parser which causes instance paths containing among other thing the # character to completely break. Fix by replacing the ini package with a Factorio compatible implementation of INI parsing and serialization. Resolves the problem in #414.
This commit is contained in:
1 parent
642504874b
commit
f529457f96
5 files changed
+192
-6
No files matched your search
@@ -2,10 +2,10 @@
|
||||
"use strict";
|
||||
const fs = require("fs-extra");
|
||||
const path = require("path");
|
||||
const ini = require("ini");
|
||||
const Jimp = require("jimp");
|
||||
const JSZip = require("jszip");
|
||||
|
||||
const libIni = require("../ini");
|
||||
const libBuildMod = require("../build_mod");
|
||||
|
||||
/**
|
||||
@@ -312,7 +312,7 @@ async function exportLocale(server, modVersions, modOrder, languageCode) {
|
||||
}
|
||||
|
||||
let baseLocaleFilePath = server.dataPath("base", "locale", languageCode, "base.cfg");
|
||||
mergeLocale(ini.parse(await fs.readFile(baseLocaleFilePath, "utf8")));
|
||||
mergeLocale(libIni.parse(await fs.readFile(baseLocaleFilePath, "utf8")));
|
||||
|
||||
for (let mod of modOrder) {
|
||||
if (["core", "base", "export"].includes(mod)) {
|
||||
@@ -330,7 +330,7 @@ async function exportLocale(server, modVersions, modOrder, languageCode) {
|
||||
}
|
||||
for (let file of zip.file(new RegExp(`locale\\/${languageCode}\\/.*\\.cfg`))) {
|
||||
let content = await file.async("nodebuffer");
|
||||
mergeLocale(ini.parse(content.toString("utf8")));
|
||||
mergeLocale(libIni.parse(content.toString("utf8")));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user