@@ -22,6 +22,8 @@ import ZipBuilder from '../../providers/generic/zip/ZipBuilder';
22
22
import InteractionProvider from '../../providers/ror2/system/InteractionProvider' ;
23
23
import { ProfileApiClient } from '../profiles/ProfilesClient' ;
24
24
25
+ const FALLBACK_ICON = require ( "../../../public/unknown.png" ) ;
26
+
25
27
export default class ProfileModList {
26
28
27
29
public static SUPPORTED_CONFIG_FILE_EXTENSIONS = [ ".cfg" , ".txt" , ".json" , ".yml" , ".yaml" , ".ini" ] ;
@@ -280,15 +282,18 @@ export default class ProfileModList {
280
282
}
281
283
282
284
public static async setIconPath ( mod : ManifestV2 , profile : ImmutableProfile ) : Promise < void > {
283
- let iconPath = path . resolve ( profile . getProfilePath ( ) , "BepInEx" , "plugins" , mod . getName ( ) , "icon.png" ) ;
285
+ const paths = [
286
+ path . resolve ( profile . getProfilePath ( ) , "BepInEx" , "plugins" , mod . getName ( ) , "icon.png" ) ,
287
+ path . join ( PathResolver . MOD_ROOT , "cache" , mod . getName ( ) , mod . getVersionNumber ( ) . toString ( ) , "icon.png" ) ,
288
+ ]
284
289
285
- // BepInEx is not a plugin, and so the only place where we can get its icon is from the cache.
286
- // Also non-BepInEx games, e.g. ReturnOfModding games, read the icons from cache. This could
287
- // be fixed using a different path though.
288
- if ( ! ( await FsProvider . instance . exists ( iconPath ) ) ) {
289
- iconPath = path . join ( PathResolver . MOD_ROOT , "cache" , mod . getName ( ) , mod . getVersionNumber ( ) . toString ( ) , "icon.png" ) ;
290
+ for ( const iconPath of paths ) {
291
+ if ( await FsProvider . instance . exists ( iconPath ) ) {
292
+ mod . setIcon ( iconPath ) ;
293
+ return ;
294
+ }
290
295
}
291
296
292
- mod . setIcon ( iconPath ) ;
297
+ mod . setIcon ( FALLBACK_ICON ) ;
293
298
}
294
299
}
0 commit comments