SurviePote 2/4: atlas Nebula (serveur SurviePote-26.3, distribution.json, sans binaires)
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
import { join } from 'path'
|
||||
import { URL } from 'url'
|
||||
import { BaseFileStructure } from '../BaseFileStructure.js'
|
||||
import { MinecraftVersion } from '../../util/MinecraftVersion.js'
|
||||
|
||||
export class VersionRepoStructure extends BaseFileStructure {
|
||||
|
||||
private name: string
|
||||
|
||||
constructor(
|
||||
absoluteRoot: string,
|
||||
relativeRoot: string,
|
||||
name: string
|
||||
) {
|
||||
super(absoluteRoot, relativeRoot, 'versions')
|
||||
this.name = name
|
||||
}
|
||||
|
||||
public getLoggerName(): string {
|
||||
return 'VersionRepoStructure'
|
||||
}
|
||||
|
||||
public getFileName(minecraftVersion: MinecraftVersion, loaderVersion: string): string {
|
||||
return `${minecraftVersion}-${this.name}-${loaderVersion}`
|
||||
}
|
||||
|
||||
public getVersionManifest(minecraftVersion: MinecraftVersion, loaderVersion: string): string {
|
||||
const fileName = this.getFileName(minecraftVersion, loaderVersion)
|
||||
return join(this.containerDirectory, fileName, `${fileName}.json`)
|
||||
}
|
||||
|
||||
public getVersionManifestURL(url: string, minecraftVersion: MinecraftVersion, loaderVersion: string): string {
|
||||
const fileName = this.getFileName(minecraftVersion, loaderVersion)
|
||||
return new URL(join(this.relativeRoot, fileName, `${fileName}.json`), url).toString()
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user