Changeset 8ab3302 in sasview for sansguiframe/src


Ignore:
Timestamp:
Dec 22, 2011 11:55:32 AM (13 years ago)
Author:
Jae Cho <jhjcho@…>
Branches:
master, ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc, costrafo411, magnetic_scatt, release-4.1.1, release-4.1.2, release-4.2.2, release_4.0.1, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
Children:
273801b
Parents:
7983000f
Message:

fixed a little bit the setting of .sansview folder

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sansguiframe/src/sans/guiframe/customdir.py

    rf9505c30 r8ab3302  
    1212    The plugin directory is located in the user's home directory. 
    1313    """ 
    14     dir = os.path.join(os.path.expanduser("~"), ("." + APPLICATION_NAME), CONF_DIR) 
     14    dir = os.path.join(os.path.expanduser("~"),  
     15                       ("." + APPLICATION_NAME), CONF_DIR) 
    1516     
    1617    return dir 
     
    2627    file = os.path.join(dir, "custom_config.py") 
    2728    # Place example user models as needed 
    28     if not os.path.isfile(file): 
    29         shutil.copyfile(os.path.join(path, "custom_config.py"), file) 
     29    try: 
     30        if not os.path.isfile(file): 
     31         shutil.copyfile(os.path.join(path, "custom_config.py"), file) 
     32    except: 
     33        # Check for data path next to exe/zip file. 
     34        #Look for maximum n_dir up of the current dir to find plugins dir 
     35        n_dir = 12 
     36        is_dir = False 
     37        f_dir = path 
     38        for i in range(n_dir): 
     39            if i > 1: 
     40                f_dir, _ = os.path.split(f_dir) 
     41            temp_path = os.path.join(f_dir, "custom_config.py") 
     42            if os.path.isfile(temp_path): 
     43                shutil.copyfile(temp_path, file) 
     44                is_dir = True 
     45                break 
     46        if not is_dir: 
     47            raise 
    3048         
    3149    return dir 
Note: See TracChangeset for help on using the changeset viewer.