added methods for working with ~/.pmc/XYZ paths

--HG--
branch : pmacs2
This commit is contained in:
Erik Osheim 2010-09-11 10:29:41 -04:00
parent 48d328b144
commit 3d8b0036d1
1 changed files with 12 additions and 0 deletions

View File

@ -655,6 +655,18 @@ class Application(object):
f = getattr(self.window(), methodname) f = getattr(self.window(), methodname)
f() f()
# build application-centric paths
def getpath(self, *parts):
return os.path.join(os.getenv('HOME'), '.pmc', *parts)
# create directories under the application path
def mkdirs(self, *parts):
path = self.getpath()
for part in parts:
path = os.path.join(path, part)
if not os.path.exists(path):
os.mkdir(path)
# load user configuration NOW # load user configuration NOW
def loadrc(self): def loadrc(self):
path = os.path.join(os.getenv('HOME'), '.pmc', 'conf') path = os.path.join(os.getenv('HOME'), '.pmc', 'conf')