@@ -2,7 +2,7 @@ import * as vscode from 'vscode';
22import * as path from 'path' ;
33import * as nodefs from 'fs' ;
44
5- import { API } from './vscode-dosbox' ;
5+ import { API , Dosbox } from './vscode-dosbox' ;
66import * as statusBar from './statusBar' ;
77import * as Diag from '../diagnose/main' ;
88import * as conf from '../utils/configuration' ;
@@ -48,6 +48,23 @@ export async function activate(context: vscode.ExtensionContext) {
4848 const assemblyToolsFolder = vscode . Uri . joinPath ( context . globalStorageUri , conf . extConf . asmType ) ;
4949 const seperateSpaceFolder = vscode . Uri . joinPath ( context . globalStorageUri , "workspace" ) ;
5050
51+ function updateDosboxConf ( box : Dosbox ) {
52+ let confSting = "dosbox.config" ;
53+ if ( conf . extConf . emulator === conf . DosEmulatorType . dosboxX ) {
54+ confSting = "dosboxX.config" ;
55+ }
56+ if ( conf . extConf . _conf . has ( confSting ) ) {
57+ const dosboxConf : { [ id : string ] : string } | undefined = conf . extConf . _conf . get ( confSting ) ;
58+ if ( dosboxConf ) {
59+ for ( const id in dosboxConf ) {
60+ const [ section , key ] = id . toLowerCase ( ) . split ( '.' ) ;
61+ const value = dosboxConf [ id ] ;
62+ box . updateConf ( section , key , value ) ;
63+ }
64+ }
65+ }
66+ }
67+
5168 async function singleFileMode ( act : conf . actionType , _uri : vscode . Uri ) : Promise < AsmResult > {
5269 logger . channel ( actionMessage ( act , _uri . fsPath ) ) ;
5370
@@ -130,18 +147,7 @@ export async function activate(context: vscode.ExtensionContext) {
130147 }
131148 }
132149
133- const dosboxConf : { [ id : string ] : string } | undefined =
134- conf . extConf . emulator === conf . DosEmulatorType . dosboxX
135- ? vscode . workspace . getConfiguration ( "masmtasm" ) . get ( "dosbox.config" )
136- : vscode . workspace . getConfiguration ( "masmtasm" ) . get ( "dosboxX.config" ) ;
137- if ( dosboxConf ) {
138- for ( const id in dosboxConf ) {
139- const [ section , key ] = id . toLowerCase ( ) . split ( '.' ) ;
140- const value = dosboxConf [ id ] ;
141- box . updateConf ( section , key , value ) ;
142- }
143- }
144-
150+ updateDosboxConf ( box ) ;
145151 box . updateAutoexec ( autoexec ) ;
146152
147153 if ( act !== conf . actionType . open ) {
@@ -375,18 +381,7 @@ export async function activate(context: vscode.ExtensionContext) {
375381 }
376382 }
377383
378- const dosboxConf : { [ id : string ] : string } | undefined =
379- conf . extConf . emulator === conf . DosEmulatorType . dosboxX
380- ? vscode . workspace . getConfiguration ( "masmtasm" ) . get ( "dosbox.config" )
381- : vscode . workspace . getConfiguration ( "masmtasm" ) . get ( "dosboxX.config" ) ;
382- if ( dosboxConf ) {
383- for ( const id in dosboxConf ) {
384- const [ section , key ] = id . toLowerCase ( ) . split ( '.' ) ;
385- const value = dosboxConf [ id ] ;
386- box . updateConf ( section , key , value ) ;
387- }
388- }
389-
384+ updateDosboxConf ( box ) ;
390385 box . updateAutoexec ( autoexec ) ;
391386
392387 if ( act !== conf . actionType . open ) {
0 commit comments