Changes in src/sas/_config.py [93b34cc:b963b20] in sasview


Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/sas/_config.py

    r93b34cc rb963b20  
    8686def setup_custom_config(app_dir, user_dir): 
    8787    path = make_custom_config_path(user_dir) 
    88     #logger.info("custom config path %s", path) 
    8988    if not os.path.isfile(path): 
    9089        try: 
     
    9594            logger.error("Could not copy default custom config.") 
    9695 
    97     custom_config = load_custom_config(path) 
    98  
    9996    #Adding SAS_OPENCL if it doesn't exist in the config file 
    10097    # - to support backcompability 
    101     if not hasattr(custom_config, "SAS_OPENCL"): 
    102         custom_config.SAS_OPENCL = None 
     98    if not "SAS_OPENCL" in open(path).read(): 
    10399        try: 
    104             open(path, "a+").write("SAS_OPENCL = \"None\"\n") 
     100            open(config_file, "a+").write("SAS_OPENCL = \"None\"\n") 
    105101        except Exception: 
    106102            logger.error("Could not update custom config with SAS_OPENCL.") 
    107103 
     104    custom_config = load_custom_config(path) 
    108105    return custom_config 
     106 
    109107 
    110108def load_custom_config(path): 
Note: See TracChangeset for help on using the changeset viewer.