From 2ee1943b4cdafbd35b82341bbf0281721840c7e3 Mon Sep 17 00:00:00 2001 From: Chris Jones Date: Mon, 25 Feb 2008 00:00:10 +0000 Subject: [PATCH] Update Thomas Meire's cwd patch so it's clear that it's OS specific, choose a default cwd. LP #181194 --- terminator | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/terminator b/terminator index e199f1d3..7a60e351 100755 --- a/terminator +++ b/terminator @@ -18,7 +18,7 @@ """Terminator by Chris Jones """ # import standard python libs -import os, sys, string, time, math +import os, platform, sys, string, time, math from optparse import OptionParser import gettext @@ -111,8 +111,6 @@ class TerminatorTerm: self.gconf_client = gconf.client_get_default () self.command = command - # Open first tab in ~ or in cwd from parent? - #self.cwd = cwd or os.path.expanduser ("~"); self.cwd = cwd or os.getcwd(); if profile == None: @@ -206,10 +204,17 @@ class TerminatorTerm: def get_cwd (self): """ Return the current working directory of the subprocess. - This function is NOT portable, as it relies on a *nix-specific - path. This won't work on Windows. + This function requires OS specific behaviours """ - return os.path.realpath("/proc/%s/cwd" % self._pid) + system = platform.system () + + if system == 'Linux': + cwd = os.path.realpath ('/proc/%s/cwd' % self._pid) + else: + # We don't have a child cwd getter for this platform, so let + # TerminatorTerm use its default + cwd = None + return (cwd) def reconf (self, property): value = self.gconf_client.get ('%s/%s'%(self.profile, property))