From a7391742d10f0461090cdac3b5014e325cfff6f1 2007-08-29 12:47:38 From: vivainio Date: 2007-08-29 12:47:38 Subject: [PATCH] ipy_workdir translates cmd path --- diff --git a/IPython/Extensions/ipy_workdir.py b/IPython/Extensions/ipy_workdir.py index 3dd4f2f..38a0b1d 100644 --- a/IPython/Extensions/ipy_workdir.py +++ b/IPython/Extensions/ipy_workdir.py @@ -15,7 +15,14 @@ def workdir_f(line): elif workdir is None: print "Please set workdir first by doing e.g. 'workdir q:/'" else: - print "Execute command in",workdir + sp = cmd.split(None,1) + if len(sp) == 1: + head, tail = cmd, '' + else: + head, tail = sp + if os.path.isfile(head): + cmd = os.path.abspath(head) + ' ' + tail + print "Execute command",cmd,"in",workdir ret = subprocess.call(cmd, shell = True, cwd = workdir) ip.defalias("workdir",workdir_f)