fixed shebangs in non executable .py files
[nepi.git] / src / nepi / util / environ.py
index 8a2a90d..0f2e455 100644 (file)
@@ -1,4 +1,3 @@
-# vim:ts=4:sw=4:et:ai:sts=4
 
 import os, subprocess, os.path
 
@@ -57,13 +56,16 @@ def backticks(cmd):
         raise RuntimeError("Error executing `%s': %s" % (" ".join(cmd), err))
     return out
 
-def homepath(path, app='.nepi', mode = 0500):
+def homepath(path, app='.nepi', mode = 0500, directory = False):
     home = os.environ.get('HOME')
     if home is None:
         home = os.path.join(os.sep, 'home', os.getlogin())
     
     path = os.path.join(home, app, path)
-    dirname = os.path.dirname(path)
+    if directory:
+        dirname = path
+    else:
+        dirname = os.path.dirname(path)
     if not os.path.exists(dirname):
         os.makedirs(dirname)