Changeset 3ee8a49 in sasview


Ignore:
Timestamp:
Jan 11, 2012 4:03:29 PM (13 years ago)
Author:
Mathieu Doucet <doucetm@…>
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:
42c4f86
Parents:
c9de078
Message:

trying to fix windows installer

File:
1 edited

Legend:

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

    rc9de078 r3ee8a49  
    4242from sans.dataloader.loader import Loader 
    4343 
    44 # gui_manager should not know about sansview 
    45 #from sans import sansview 
    46 #PATH_APP = os.path.dirname(sansview.__file__) 
    47  
    4844def get_app_dir(): 
    4945    """ 
     46        The application directory is the one where the default custom_config.py 
     47        file resides. 
    5048    """ 
    51     if os.name=='nt': 
    52         logging.info(sys.executable) 
    53         logging.info(str(sys.argv)) 
    54         app_path = sys.path[0] 
    55         if os.path.isfile(app_path): 
    56             app_path = os.path.dirname(app_path) 
    57         return os.path.abspath(app_path) 
    58     else: 
    59         from sans import sansview 
    60         return os.path.dirname(sansview.__file__) 
     49    # First, try the directory of the executable we are running 
     50    app_path = sys.path[0] 
     51    if os.path.isfile(app_path): 
     52        app_path = os.path.dirname(app_path) 
     53    if os.path.isfile(os.path.join(app_path, "custom_config.py")): 
     54        app_path = os.path.abspath(app_path) 
     55        logging.info("Using application path: %s", app_path) 
     56        return app_path 
     57     
     58    # Next, try the current working directory 
     59    if os.path.isfile(os.path.join(os.getcwd(), "custom_config.py")): 
     60        logging.info("Using application path: %s", os.getcwd()) 
     61        return os.path.abspath(os.getcwd()) 
     62     
     63    # Finally, try the directory of the sansview module 
     64    #TODO: gui_manager will have to know about sansview until we 
     65    # clean all these module variables and put them into a config class 
     66    # that can be passed by sansview.py. 
     67    logging.info(sys.executable) 
     68    logging.info(str(sys.argv)) 
     69    from sans import sansview 
     70    app_path = os.path.dirname(sansview.__file__) 
     71    logging.info("Using application path: %s", app_path) 
     72    return app_path 
    6173 
    6274def get_user_directory(): 
Note: See TracChangeset for help on using the changeset viewer.