1 |
import os |
2 |
|
3 |
class FraggleEngine: |
4 |
|
5 |
def getDefaultDir(self): |
6 |
"""Gets location of default dir and creates it |
7 |
if necessary. ($HOME/.pears/)""" |
8 |
try: |
9 |
import pearsdebug |
10 |
savedir = pearsdebug.savedir |
11 |
except: |
12 |
dir = '.netfraggle' |
13 |
savedir = os.path.expanduser(os.path.join('~', dir)) |
14 |
if len(savedir)<=len("c:\\/" + dir): |
15 |
# problem that might occur on Win2k (no $HOME environment variable) |
16 |
temp = os.path.join(os.path.expandvars('$USERPROFILE'), dir) |
17 |
if temp > len("c:\\/" + dir): |
18 |
savedir = temp |
19 |
# create dir if it doesn't exist |
20 |
if not os.path.exists(savedir): |
21 |
os.makedirs(savedir) |
22 |
return savedir |