Changeset c6c17e3 in sasview for sansguiframe/src


Ignore:
Timestamp:
Aug 15, 2011 10:54:24 AM (13 years ago)
Author:
Gervaise Alina <gervyh@…>
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:
546521e
Parents:
96cbb53
Message:

refactory set current directory of app

File:
1 edited

Legend:

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

    rcdda552 rc6c17e3  
    4141 
    4242DATAPATH = os.getcwd() 
    43 tem_path = sys.path[0] 
    44 if os.path.isfile(tem_path): 
    45     tem_path = os.path.dirname(tem_path) 
    46 os.chdir(tem_path) 
     43def _change_current_dir(): 
     44    """ 
     45    Get the path of the current ran file and change the application current 
     46    directory to the directory of that file 
     47    """ 
     48    tem_path = sys.path[0] 
     49    if os.path.isfile(tem_path): 
     50        tem_path = os.path.dirname(tem_path) 
     51     
     52    os.chdir(os.path.abspath(tem_path)) 
     53     
     54     
     55_change_current_dir()     
    4756PATH_APP = os.getcwd() 
    4857 
     
    25922601        temp_path = None 
    25932602        try: 
    2594             # make sure the current dir is App dir when it starts 
    2595             temp_path = os.path.dirname(sys.path[0]) 
    2596             os.chdir(temp_path) 
     2603            _change_current_dir() 
    25972604        except: 
    25982605            pass 
Note: See TracChangeset for help on using the changeset viewer.