Spaces:
Sleeping
Sleeping
Commit
Browse files- src/mods/mods.ts +3 -2
src/mods/mods.ts
CHANGED
|
@@ -8,6 +8,7 @@ import { ModMetadata } from "./mod-metadata";
|
|
| 8 |
|
| 9 |
export class ModManager {
|
| 10 |
private server: Server;
|
|
|
|
| 11 |
|
| 12 |
constructor(server: Server) {
|
| 13 |
this.server = server;
|
|
@@ -22,14 +23,14 @@ export class ModManager {
|
|
| 22 |
|
| 23 |
for (const mod of mods) {
|
| 24 |
this.server.get(`/files/mods/${mod.filename}`, (_req, res) => {
|
| 25 |
-
const filepath = path.join(
|
| 26 |
res.download(filepath);
|
| 27 |
})
|
| 28 |
}
|
| 29 |
}
|
| 30 |
|
| 31 |
private async getModList(): Promise<Mod[]> {
|
| 32 |
-
const modFolderPath = path.join(
|
| 33 |
|
| 34 |
const filenames = await readdir(modFolderPath);
|
| 35 |
|
|
|
|
| 8 |
|
| 9 |
export class ModManager {
|
| 10 |
private server: Server;
|
| 11 |
+
private root: string = path.join("../", __dirname);
|
| 12 |
|
| 13 |
constructor(server: Server) {
|
| 14 |
this.server = server;
|
|
|
|
| 23 |
|
| 24 |
for (const mod of mods) {
|
| 25 |
this.server.get(`/files/mods/${mod.filename}`, (_req, res) => {
|
| 26 |
+
const filepath = path.join(this.root, "mods", mod.filename)
|
| 27 |
res.download(filepath);
|
| 28 |
})
|
| 29 |
}
|
| 30 |
}
|
| 31 |
|
| 32 |
private async getModList(): Promise<Mod[]> {
|
| 33 |
+
const modFolderPath = path.join(this.root, "mods");
|
| 34 |
|
| 35 |
const filenames = await readdir(modFolderPath);
|
| 36 |
|