- Timestamp:
- Jan 29, 2014 12:18:29 PM (11 years ago)
- 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:
- d2564a5
- Parents:
- e090c624
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sans/guiframe/CategoryInstaller.py
r16bd5ca r64beda4 49 49 returns the dir where default_cat.p should be 50 50 """ 51 # The default categories file is usually found with the code 51 # The default categories file is usually found with the code, except 52 # when deploying using py2app (it will be in Contents/Resources), or 53 # py2exe (it will be in the exec dir). 52 54 import sans.sansview 53 55 cat_file = "default_categories.p" 54 dir, file_name = os.path.split(sans.sansview.__file__)55 cat_file_path = os.path.join(dir, cat_file)56 if os.path.isfile(cat_file_path):57 cat_file_dir = os.path.dirname(cat_file_path)58 return cat_file_dir59 56 60 # When deploying using py2app, the default categories file 61 # can be found in Contents/Resources 62 cat_file_path = os.path.join(os.path.dirname(sys.executable), '..', 'Resources', 'default_categories.p') 63 if os.path.isfile(cat_file_path): 64 cat_file_dir = os.path.dirname(cat_file_path) 65 return cat_file_dir 66 57 possible_cat_file_paths = [ 58 os.path.join(os.path.split(sans.sansview.__file__)[0], cat_file), # Source 59 os.path.join(os.path.dirname(sys.executable), '..', 'Resources', cat_file), # Mac 60 os.path.join(os.path.dirname(sys.executable), cat_file) # Windows 61 ] 62 63 for path in possible_cat_file_paths: 64 if os.path.isfile(path): 65 return os.path.dirname(path) 66 67 67 raise RuntimeError('CategoryInstaller: Could not find folder containing default categories') 68 68
Note: See TracChangeset
for help on using the changeset viewer.