def appdir_from_executable(exepath): """Find the top-level application directory, given sys.executable.""" vdir = _bs_appdir_from_executable(exepath) appdir = os.path.dirname(vdir) if os.path.exists(os.path.join(appdir,ESKY_CONTROL_DIR,"bootstrap-manifest.txt")): appdir = os.path.dirname(appdir) return appdir
def appdir_from_executable(exepath): """Find the top-level application directory, given sys.executable.""" # The standard layout is <appdir>/ESKY_APPDATA_DIR/<vdir>/<exepath>. # Stripping of <exepath> is done by _bs_appdir_from_executable. vdir = _bs_appdir_from_executable(exepath) appdir = os.path.dirname(vdir) # On OSX we sometimes need to strip an additional directory since the # app can be contained in an <appname>.app directory. if sys.platform == "darwin" and is_version_dir(appdir): appdir = os.path.dirname(appdir) # TODO: remove compatability hook for ESKY_APPDATA_DIR="" if ESKY_APPDATA_DIR and os.path.basename(appdir) == ESKY_APPDATA_DIR: appdir = os.path.dirname(appdir) return appdir