pwd command

--HG--
branch : pmacs2
This commit is contained in:
moculus 2008-11-29 19:52:03 +00:00
parent abafebd389
commit 3947460779
1 changed files with 8 additions and 4 deletions

View File

@ -131,7 +131,11 @@ class ToggleTabs(Method):
class Pwd(Method):
'''Print the buffer's current working directory'''
def _execute(self, w, **vargs):
cwd = os.path.dirname(w.buffer.path) + '/'
if cwd.startswith(os.getenv('HOME')):
cwd = cwd.replace(os.getenv('HOME'), '~')
w.set_error("Directory %s" % cwd)
home = os.getenv('HOME')
if hasattr(w.buffer, 'path'):
cwd = os.path.dirname(w.buffer.path) + '/'
if cwd.startswith(home):
cwd = cwd.replace(home, '~')
w.set_error("Directory %s" % cwd)
else:
w.set_error("Directory %s/" % os.getcwd())