def get_app_dir(app_name, roaming=True, force_posix=False):
 if WIN:
  key = ((roaming and 'APPDATA') or 'LOCALAPPDATA')
  folder = os.environ.get(key)
  if (folder is None):
   folder = os.path.expanduser('~')
  return os.path.join(folder, app_name)
 if force_posix:
  return os.path.join(os.path.expanduser(('~/.' + _posixify(app_name))))
 if (sys.platform == 'darwin'):
  return os.path.join(os.path.expanduser('~/Library/Application Support'), app_name)
 return os.path.join(os.environ.get('XDG_CONFIG_HOME', os.path.expanduser('~/.config')), _posixify(app_name))

def get_app_dir ( app_name , roaming = True , force_posix = False ) : if WIN : key = ( ( roaming and 'APPDATA' ) or 'LOCALAPPDATA' ) folder = os . environ . get ( key ) if ( folder is None ) : folder = os . path . expanduser ( '~' ) return os . path . join ( folder , app_name ) if force_posix : return os . path . join ( os . path . expanduser ( ( '~/.' + _posixify ( app_name ) ) ) ) if ( sys . platform == 'darwin' ) : return os . path . join ( os . path . expanduser ( '~/Library/Application Support' ) , app_name ) return os . path . join ( os . environ . get ( 'XDG_CONFIG_HOME' , os . path . expanduser ( '~/.config' ) ) , _posixify ( app_name ) )
returns the config folder for the application .