def _desktop_directory(): try: if sys.platform.startswith('win'): import appdirs # https://msdn.microsoft.com/en-us/library/windows/desktop/bb762494(v=vs.85).aspx return appdirs._get_win_folder('CSIDL_DESKTOPDIRECTORY') else: return os.path.join(os.path.expanduser('~'), 'Desktop') except (KeyError, ValueError): return os.getcwd()
def get_license_location(): """Return the ActiveState license file location""" try: return os.environ['ACTIVESTATE_LICENSE'] except KeyError: try: asdir = os.environ['ACTIVESTATE_HOME'] except KeyError: if sys.platform.startswith('win'): from appdirs import _get_win_folder appdata = _get_win_folder("CSIDL_APPDATA") asdir = P.join(appdata, 'ActiveState') elif sys.platform.startswith('darwin'): asdir = P.expanduser('~/Library/Application Support/ActiveState') else: asdir = P.expanduser('~/.ActiveState') return P.join(asdir, 'ActiveState.lic')
def get_license_location(): """Return the ActiveState license file location""" try: return os.environ['ACTIVESTATE_LICENSE'] except KeyError: try: asdir = os.environ['ACTIVESTATE_HOME'] except KeyError: if sys.platform.startswith('win'): from appdirs import _get_win_folder appdata = _get_win_folder("CSIDL_APPDATA") asdir = P.join(appdata, 'ActiveState') elif sys.platform.startswith('darwin'): asdir = P.expanduser( '~/Library/Application Support/ActiveState') else: asdir = P.expanduser('~/.ActiveState') return P.join(asdir, 'ActiveState.lic')
def get_license_location(): """Return the ActiveState license file location""" try: return os.environ['ACTIVESTATE_LICENSE'] except KeyError: try: asdir = os.environ['ACTIVESTATE_HOME'] except KeyError: if sys.platform == 'win32': from appdirs import _get_win_folder appdata = _get_win_folder("CSIDL_APPDATA") asdir = P.join(appdata, 'ActiveState') else: # sudo may not update $HOME import pwd real_home = pwd.getpwuid(os.getuid()).pw_dir or os.getenv('HOME') if sys.platform.startswith('darwin'): asdir = P.join(real_home, 'Library/Application Support/ActiveState') else: asdir = P.join(real_home, '.ActiveState') return P.join(asdir, 'ActiveState.lic')