Sort forgemods by file name to control load order.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { Stats } from 'fs-extra'
|
||||
import { Type } from 'helios-distribution-types'
|
||||
import { Type, Module } from 'helios-distribution-types'
|
||||
import { join } from 'path'
|
||||
import { resolve } from 'url'
|
||||
import { VersionSegmented } from '../../../../util/VersionSegmented'
|
||||
@@ -21,6 +21,15 @@ export abstract class BaseForgeModStructure extends ToggleableModuleStructure im
|
||||
super(absoluteRoot, relativeRoot, 'forgemods', baseUrl, minecraftVersion, Type.ForgeMod)
|
||||
}
|
||||
|
||||
public async getSpecModel(): Promise<Module[]> {
|
||||
// Sort by file name to allow control of load order.
|
||||
return (await super.getSpecModel()).sort((a, b) => {
|
||||
const aFileName = a.artifact.url.substring(a.artifact.url.lastIndexOf('/')+1)
|
||||
const bFileName = b.artifact.url.substring(b.artifact.url.lastIndexOf('/')+1)
|
||||
return aFileName.localeCompare(bFileName)
|
||||
})
|
||||
}
|
||||
|
||||
public abstract isForVersion(version: MinecraftVersion, libraryVersion: string): boolean
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
|
||||
Reference in New Issue
Block a user