From 3d8b0036d11db6b54e7c879a3c05765fdf0b2b8d Mon Sep 17 00:00:00 2001 From: Erik Osheim Date: Sat, 11 Sep 2010 10:29:41 -0400 Subject: [PATCH] added methods for working with ~/.pmc/XYZ paths --HG-- branch : pmacs2 --- application.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/application.py b/application.py index a7b2a87..ab80a92 100755 --- a/application.py +++ b/application.py @@ -655,6 +655,18 @@ class Application(object): f = getattr(self.window(), methodname) 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 def loadrc(self): path = os.path.join(os.getenv('HOME'), '.pmc', 'conf')