11import { readFileSync , writeFileSync } from 'fs' ;
2- import { extname } from 'path' ;
32import { observable , computed , action , autorun } from 'mobx' ;
43import range from 'lodash/range' ;
54import unique from 'lodash/uniq' ;
@@ -114,11 +113,10 @@ class Environment {
114113 // load mappings
115114 if ( obj . mappings . path ) {
116115 const mappingPath = workspace . absolutePath ( obj . mappings . path ) ;
117- const isAsm = extname ( obj . mappings . path ) == '.asm' ;
118116 try {
119117 const buffer = readFileSync ( mappingPath ) ;
120118 const newMappings = bufferToMappings (
121- isAsm ? asmToBin ( buffer ) : buffer ,
119+ obj . mappingsASM ? asmToBin ( buffer ) : buffer ,
122120 obj . mappingDefinition ,
123121 ) ;
124122 this . mappings . replace ( newMappings ) ;
@@ -134,11 +132,10 @@ class Environment {
134132 this . config . dplcsEnabled = obj . dplcs . enabled == true && obj . dplcs . path ;
135133 if ( this . config . dplcsEnabled && obj . dplcs . path ) {
136134 const dplcPath = workspace . absolutePath ( obj . dplcs . path ) ;
137- const isAsm = extname ( obj . dplcs . path ) == '.asm' ;
138135 try {
139136 const buffer = readFileSync ( dplcPath ) ;
140137 const newDPLCs = bufferToDPLCs (
141- isAsm ? asmToBin ( buffer ) : buffer ,
138+ obj . dplcsASM ? asmToBin ( buffer ) : buffer ,
142139 obj . dplcDefinition ,
143140 ) ;
144141 this . dplcs . replace ( newDPLCs ) ;
@@ -200,10 +197,9 @@ class Environment {
200197 // mappings
201198 if ( obj . mappings . path ) {
202199 const mappingPath = workspace . absolutePath ( obj . mappings . path ) ;
203- const isAsm = extname ( obj . mappings . path ) == '.asm' ;
204200
205201 const { chunk, frames } = mappingsToBuffer ( this . mappings , obj . mappingDefinition ) ;
206- const out = isAsm ? stuffToAsm ( frames , obj . mappings . label , true ) : chunk ;
202+ const out = obj . mappingsASM ? stuffToAsm ( frames , obj . mappings . label , true ) : chunk ;
207203 try {
208204 writeFileSync ( mappingPath , out ) ;
209205 }
@@ -215,10 +211,9 @@ class Environment {
215211 // dplcs
216212 if ( obj . dplcs . enabled && obj . dplcs . path ) {
217213 const dplcPath = workspace . absolutePath ( obj . dplcs . path ) ;
218- const isAsm = extname ( obj . dplcs . path ) == '.asm' ;
219214
220215 const { chunk, frames } = DPLCsToBuffer ( this . dplcs , obj . dplcDefinition ) ;
221- const out = isAsm ? stuffToAsm ( frames , obj . dplcs . label ) : chunk ;
216+ const out = obj . dplcsASM ? stuffToAsm ( frames , obj . dplcs . label ) : chunk ;
222217 try {
223218 writeFileSync ( dplcPath , out ) ;
224219 }
0 commit comments