2006-05-18 06:24:32 +02:00
|
|
|
import os
|
|
|
|
|
2006-05-12 08:46:59 +02:00
|
|
|
try:
|
2006-05-18 06:24:32 +02:00
|
|
|
from sugar.__uninstalled__ import *
|
2006-05-12 08:46:59 +02:00
|
|
|
except ImportError:
|
2006-05-18 06:24:32 +02:00
|
|
|
from sugar.__installed__ import *
|
2006-05-22 03:31:57 +02:00
|
|
|
|
|
|
|
def get_user_dir():
|
2006-05-23 04:14:22 +02:00
|
|
|
if os.environ.has_key('SUGAR_USER_DIR'):
|
|
|
|
return os.environ['SUGAR_USER_DIR']
|
|
|
|
else:
|
|
|
|
return os.path.expanduser('~/.sugar/')
|
|
|
|
|
|
|
|
def get_nick_name():
|
|
|
|
if os.environ.has_key('SUGAR_NICK_NAME'):
|
|
|
|
return os.environ['SUGAR_NICK_NAME']
|
|
|
|
else:
|
|
|
|
return None
|
2006-05-18 06:24:32 +02:00
|
|
|
|
2006-05-12 08:46:59 +02:00
|
|
|
def get_data_file(filename):
|
2006-05-18 06:24:32 +02:00
|
|
|
for data_dir in get_data_dirs():
|
|
|
|
path = os.path.join(data_dir, filename)
|
|
|
|
if os.path.isfile(path):
|
|
|
|
return path
|
|
|
|
return None
|
|
|
|
|
|
|
|
def get_data_dirs():
|
|
|
|
dirs = []
|
|
|
|
for data_dir in data_dirs:
|
|
|
|
path = os.path.join(data_basedir, data_dir)
|
|
|
|
dirs.append(path)
|
|
|
|
return dirs
|
|
|
|
|
|
|
|
def get_activities_dir():
|
|
|
|
return activities_dir
|