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)
| 158 | return sys.path[0] |
| 159 | |
| 160 | def 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 | |
| 174 | def get_data_dir(): |
| 175 | rtrn = get_argv('--datadir') |