From 1a51ced500e68a0209029d3669e4e858ca61a0a5 Mon Sep 17 00:00:00 2001 From: Jeremy Fincher Date: Wed, 15 Oct 2003 20:34:25 +0000 Subject: [PATCH] Added support for environment variables in pathnames. --- scripts/supybot-wizard.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/scripts/supybot-wizard.py b/scripts/supybot-wizard.py index 578a0f16f..88f92dd5b 100755 --- a/scripts/supybot-wizard.py +++ b/scripts/supybot-wizard.py @@ -5,6 +5,7 @@ import supybot import fix import os +import re import sys import sets import pydoc @@ -102,6 +103,7 @@ def clearLoadedPlugins(onStart, plugins): if plugin in plugins: plugins.remove(plugin) +_windowsVarRe = re.compile(r'%(\w+)%') def getDirectoryName(default): done = False while not done: @@ -110,6 +112,8 @@ def getDirectoryName(default): if not dir: dir = default dir = os.path.expanduser(dir) + dir = _windowsVarRe.sub(r'$\1', dir) + dir = os.path.expandvars(dir) dir = os.path.abspath(dir) try: os.makedirs(dir) @@ -121,7 +125,7 @@ def getDirectoryName(default): have to pick someplace else.""" % e) else: done = True - return dir + return os.path.expandvars(os.path.expanduser(dir)) def myPrint(s, unformatted=True): if unformatted: