Readd support for direct installs

This commit is contained in:
Cooldude2606 committed 2026-02-05 14:30:48 +00:00
1 parent 4cbc30f627
commit b4338a209c
4 files changed
+103 -69

No files matched your search

-26
View File
@@ -25,7 +25,6 @@ import * as lib from "@clusterio/lib";
import { ConsoleTransport, levels, logger } from "@clusterio/lib";
import Host from "./src/Host";
import { getFactorioVersion } from "./src/server";
let host: Host | undefined;
@@ -237,31 +236,6 @@ async function startHost() {
tlsCa = await fs.readFile(tlsCaPath, "utf8");
}
// Migrate from single factorio version to multiple
const factorioDir = hostConfig.get("host.factorio_directory");
const singleFactorioVersion = await getFactorioVersion(factorioDir);
if (singleFactorioVersion !== null) {
const dst = path.join(factorioDir, singleFactorioVersion);
logger.info(`Found single factorio version in ${factorioDir} moving to ${dst}`);
const stats = await fs.lstat(factorioDir);
if (stats.isSymbolicLink()) {
// For symlinks we want to move the file, but cant move it into itself so need a tmp move
const tmpPath = `${factorioDir}.tmp`;
await fs.move(factorioDir, tmpPath);
await fs.ensureDir(factorioDir);
await fs.move(tmpPath, dst);
} else {
// It is a directory here, otherwise no version would have been found
// We will only move known files in case a version was incorrectly installed in the dir
await fs.ensureDir(dst);
await Promise.all(
["bin", "data", "config-path.cfg"].map(name => (
fs.move(path.join(factorioDir, name), path.join(dst, name))
))
);
}
}
let hostConnector = new HostConnector(hostConfig, tlsCa, pluginInfos);
host = new Host(
hostConnector,