@@ -404,13 +404,13 @@ def select_os(ostype: QL_OS) -> QlClassInit['QlOs']:
404404
405405 return partial (obj )
406406
407- def profile_setup (ostype : QL_OS , config_src : Optional [Union [str , dict ]]):
407+ def profile_setup (ostype : QL_OS , user_config : Optional [Union [str , dict ]]):
408408 # mcu uses a yaml-based config
409409 if ostype == QL_OS .MCU :
410410 import yaml
411411
412- if config_src :
413- with open (config_src ) as f :
412+ if user_config :
413+ with open (user_config ) as f :
414414 config = yaml .load (f , Loader = yaml .Loader )
415415 else :
416416 config = {}
@@ -420,20 +420,18 @@ def profile_setup(ostype: QL_OS, config_src: Optional[Union[str, dict]]):
420420 int_converter = partial (int , base = 0 )
421421 config = ConfigParser (converters = {'int' : int_converter })
422422
423- # build config from dictionary, but not read from disk file
424- if isinstance (config_src , dict ):
425- config .read_dict (config_src )
423+ qiling_home = Path (inspect .getfile (inspect .currentframe ())).parent
424+ os_profile = qiling_home / 'profiles' / f'{ ostype .name .lower ()} .ql'
426425
427- else :
428- qiling_home = Path (inspect .getfile (inspect .currentframe ())).parent
429- os_profile = qiling_home / 'profiles' / f'{ ostype .name .lower ()} .ql'
426+ # read default profile first
427+ config .read (os_profile )
430428
431- profiles = [os_profile ]
429+ # user-specified profile adds or overrides existing setting
430+ if isinstance (user_config , dict ):
431+ config .read_dict (user_config )
432432
433- if config_src :
434- profiles .append (config_src )
435-
436- config .read (profiles )
433+ else :
434+ config .read (user_config )
437435
438436 return config
439437
0 commit comments