@@ -10,10 +10,10 @@ const DEFAULT_INTERFACE_VERSION = "120000";
1010 */
1111const WOWDIR_TO_TOC_SUFFIX = {
1212 // Retail family (Midnight / The War Within, including PTR & Beta)
13- _retail_ : "" ,
14- _ptr_ : "" ,
15- _xptr_ : "" ,
16- _beta_ : "" ,
13+ _retail_ : [ "" , "_Mainline" ] ,
14+ _ptr_ : [ "" , "_Mainline" ] ,
15+ _xptr_ : [ "" , "_Mainline" ] ,
16+ _beta_ : [ "" , "_Mainline" ] ,
1717
1818 // MoP Classic family
1919 _classic_ : "_Mists" ,
@@ -37,7 +37,11 @@ type WowDirToTocSuffix = typeof WOWDIR_TO_TOC_SUFFIX;
3737
3838/** Known TOC suffixes derived from the mapping for fallback */
3939const KNOWN_TOC_SUFFIXES = [
40- ...new Set ( Object . values ( WOWDIR_TO_TOC_SUFFIX ) ) ,
40+ ...new Set (
41+ Object . values ( WOWDIR_TO_TOC_SUFFIX ) . flatMap ( ( suffixes ) =>
42+ Array . isArray ( suffixes ) ? suffixes : [ suffixes ] ,
43+ ) ,
44+ ) ,
4145] as const ;
4246
4347/** Check if a string is a valid WoW directory value */
@@ -154,11 +158,15 @@ function grabVersionFromAddonToc(
154158 // 1) Try strict mapping based on the WoW directory value
155159 let resolvedTocFile : string | null = null ;
156160 if ( isWowDirValue ( dirValue ) ) {
157- const suffix = WOWDIR_TO_TOC_SUFFIX [ dirValue ] ;
158- const tocName = `${ addonName } ${ suffix } .toc` ;
159- const tocPath = path . join ( addonFolder , tocName ) ;
160- if ( fs . existsSync ( tocPath ) ) {
161- resolvedTocFile = tocPath ;
161+ const suffixes = WOWDIR_TO_TOC_SUFFIX [ dirValue ] ;
162+ const suffixList = Array . isArray ( suffixes ) ? suffixes : [ suffixes ] ;
163+ for ( const suffix of suffixList ) {
164+ const tocName = `${ addonName } ${ suffix } .toc` ;
165+ const tocPath = path . join ( addonFolder , tocName ) ;
166+ if ( fs . existsSync ( tocPath ) ) {
167+ resolvedTocFile = tocPath ;
168+ break ;
169+ }
162170 }
163171 }
164172
0 commit comments