MCPcopy Create free account
hub / github.com/brain-workshop/brainworkshop / get_settings_path

Function get_settings_path

brainworkshop.py:160–172  ·  view source on GitHub ↗

Get a directory to save user preferences. Copied from pyglet.resource so we don't have to load that module (which recursively indexes . on loading -- wtf?).

(name)

Source from the content-addressed store, hash-verified

158 return sys.path[0]
159
160def get_settings_path(name):
161 '''Get a directory to save user preferences.
162 Copied from pyglet.resource so we don't have to load that module
163 (which recursively indexes . on loading -- wtf?).'''
164 if sys.platform in ('cygwin', 'win32'):
165 if 'APPDATA' in os.environ:
166 return os.path.join(os.environ['APPDATA'], name)
167 else:
168 return os.path.expanduser('~/%s' % name)
169 elif sys.platform == 'darwin':
170 return os.path.expanduser('~/Library/Application Support/%s' % name)
171 else: # on *nix, we want it to be lowercase and without spaces (~/.brainworkshop/data)
172 return os.path.expanduser('~/.%s' % (name.lower().replace(' ', '')))
173
174def get_data_dir():
175 rtrn = get_argv('--datadir')

Callers 1

get_data_dirFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected